deploying officejs fabric react word add in2019 Community Moderator ElectionLoop inside React JSXImporting CSS files in Isomorphic React ComponentsProgrammatically navigate using react routerConfiguring CSS modules in development/production with webpack and ReactHow to fix HTML file comments not being ignored by Webpack Dev Server?ASP.Net MVC project with office ui fabric reactDotnet React template & Office Fabric UI - Issueweb add-in load issues on Outlook desktop onlyWebpack css issue, missing bundle.cssWebpack 4: Module parse failed: Unexpected token

Can I pump my MTB tire to max (55 psi / 380 kPa) without the tube inside bursting?

Can one live in the U.S. and not use a credit card?

Vocabulary for giving just numbers, not a full answer

UART pins to unpowered MCU?

finite abelian groups tensor product.

Doesn't allowing a user mode program to access kernel space memory and execute the IN and OUT instructions defeat the purpose of having CPU modes?

Shifting between bemols (flats) and diesis (sharps)in the key signature

Why does Captain Marvel assume the people on this planet know this?

Accountant/ lawyer will not return my call

What Happens when Passenger Refuses to Fly Boeing 737 Max?

Counting all the hearts

Is "conspicuously missing" or "conspicuously" the subject of this sentence?

How to write ı (i without dot) character in pgf-pie

Motivation for Zeta Function of an Algebraic Variety

Word for a person who has no opinion about whether god exists

Why doesn't this Google Translate ad use the word "Translation" instead of "Translate"?

PTIJ: Should I kill my computer after installing software?

Can Mathematica be used to create an Artistic 3D extrusion from a 2D image and wrap a line pattern around it?

weren't playing vs didn't play

Bash script should only kill those instances of another script's that it has launched

Recommendation letter by significant other if you worked with them professionally?

Why the color red for the Republican Party

What problems would a superhuman have whose skin is constantly hot?

Can you reject a postdoc offer after the PI has paid a large sum for flights/accommodation for your visit?



deploying officejs fabric react word add in



2019 Community Moderator ElectionLoop inside React JSXImporting CSS files in Isomorphic React ComponentsProgrammatically navigate using react routerConfiguring CSS modules in development/production with webpack and ReactHow to fix HTML file comments not being ignored by Webpack Dev Server?ASP.Net MVC project with office ui fabric reactDotnet React template & Office Fabric UI - Issueweb add-in load issues on Outlook desktop onlyWebpack css issue, missing bundle.cssWebpack 4: Module parse failed: Unexpected token










1















I have a word add in written in typescript using Officejs and office-ui-fabric-react. Everything works fine with the server running locally. I'd like to deploy into AWS S3 with Cloudfront. I'm building with npm run build, and npm run deploy (using deploy command "aws --profile profile-name s3 sync dist/ s3://bucketname". Static web site hosting is enabled in the S3 bucket. All files from the dist directory are seen in the bucket. After inserting the add in into Word with a manifest.xml file that points to the cloudfront endpoint I'm getting the error "Uncaught ReferenceError: React is not defined". The same error occurs when I point directly to the S3 static web endpoint. To see if I've missed anything I deployed a generic create-react-app using the steps above and it runs fine. I'm assuming that the problem lies with my webpack config so I've included that here (common, and prod). I'd be happy to include anything else that's needed. I'm also open to other deployment options if using AWS is causing the problem.



webpack.common.js:



const webpack = require('webpack');
const path = require('path');
const package = require('../package.json');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const autoprefixer = require('autoprefixer');

const build = (() =>
const timestamp = new Date().getTime();
return
name: package.name,
version: package.version,
timestamp: timestamp,
author: package.author
;
)();

const entry =
vendor: [
'react',
'react-dom',
'core-js',
'office-ui-fabric-react'
],
app: [
'react-hot-loader/patch',
'./index.tsx',
],
'function-file': '../function-file/function-file.ts'
;

const rules = [

test: /.tsx?$/,
use: [
'react-hot-loader/webpack',
'ts-loader'
],
exclude: /node_modules/
,

test: /.css$/,
use: ['style-loader', 'css-loader']
,

test: /.less$/,
use: ['style-loader', 'css-loader', 'less-loader']
,
svg
];

const output =
path: path.resolve('dist'),
publicPath: '/',
filename: '[name].[hash].js',
chunkFilename: '[id].[hash].chunk.js'
;

const WEBPACK_PLUGINS = [
new webpack.NamedModulesPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.BannerPlugin( banner: `$build.name v.$build.version ($build.timestamp) © $build.author` ),
new webpack.DefinePlugin(
ENVIRONMENT: JSON.stringify(
build: build
)
),
new webpack.LoaderOptionsPlugin(
options:
postcss: [
autoprefixer( browsers: ['Safari >= 8', 'last 2 versions'] ),
],
htmlLoader:
minimize: true


)
];

module.exports =
context: path.resolve('./src'),
entry,
output,
resolve:
extensions: ['.js', '.jsx', '.ts', '.tsx', '.scss', '.css', '.html']
,
module:
rules,
,
optimization:
splitChunks:
chunks: 'async',
minChunks: Infinity,
name: 'vendor'

,
plugins: [
...WEBPACK_PLUGINS,
new ExtractTextPlugin('[name].[hash].css'),
new HtmlWebpackPlugin(
title: 'letterConfig',
filename: 'index.html',
template: './index.html',
chunks: ['app', 'vendor', 'polyfills']
),
new HtmlWebpackPlugin(
title: 'letterConfig',
filename: 'function-file/function-file.html',
template: '../function-file/function-file.html',
chunks: ['function-file']
),
new CopyWebpackPlugin([

from: '../assets',
ignore: ['*.scss'],
to: 'assets',

])
]
;


webpack.prod.js:



const webpack = require('webpack');
const webpackMerge = require('webpack-merge');
const commonConfig = require('./webpack.common.js');
const ENV = process.env.NODE_ENV = process.env.ENV = 'development';

module.exports = webpackMerge(commonConfig,
devtool: 'source-map',

externals:
'react': 'React',
'react-dom': 'ReactDOM'
,

performance:
hints: "warning"
,

optimization:
minimize: true

);


index.tsx:



import * as React from 'react';
import * as ReactDOM from 'react-dom';
import AppContainer from 'react-hot-loader';
import initializeIcons from 'office-ui-fabric-react/lib/Icons';

import App from './components/App';

import './styles.less';
import 'office-ui-fabric-react/dist/css/fabric.min.css';

initializeIcons();

let isOfficeInitialized = false;

const title = 'letterConfig';

const render = (Component) =>
ReactDOM.render(
<AppContainer>
<Component title=title isOfficeInitialized=isOfficeInitialized />
</AppContainer>,
document.getElementById('container')
);
;

/* Render application after Office initializes */
Office.initialize = () =>
console.log('init');
isOfficeInitialized = true;
render(App);
;

/* Initial render showing a progress bar */
render(App);

if ((module as any).hot)
(module as any).hot.accept('./components/App', () =>
const NextApp = require('./components/App').default;
render(NextApp);
);










share|improve this question
























  • You should be able to host an add-in on any service. Some questions: What are the exact steps that lead to the error and where do you see the error? Are you using Office.initialize or Office.onReady? Is the React bootstrapping code inside the initialize or onReady? How are you sideloading the manifest?

    – Rick Kirkham
    Mar 6 at 17:20











  • I'm seeing the error in the console using office365. Also, just using the url in a browser shows the same error. I'm using Office.initialize, and it's bootstrapping there. I'm uisng insert->Office addins, and uploading the manifest.xml. I'll include the entire index.tsx file in the original post for clarity.

    – David Nickerson
    Mar 6 at 18:20












  • I'm still not clear on when/where you see the error. Do you have a ribbon button that opens the add-in a task pane? Is that when it errors? I don't know what "the console using office 365" means. If you comment out the line render(App) about 8 lines up from the bottom (not the one inside Office.initialize), do you still get the error? Finally, please verify that react and react-dom are in the bundle that you are hosting on AWS.

    – Rick Kirkham
    Mar 6 at 22:14















1















I have a word add in written in typescript using Officejs and office-ui-fabric-react. Everything works fine with the server running locally. I'd like to deploy into AWS S3 with Cloudfront. I'm building with npm run build, and npm run deploy (using deploy command "aws --profile profile-name s3 sync dist/ s3://bucketname". Static web site hosting is enabled in the S3 bucket. All files from the dist directory are seen in the bucket. After inserting the add in into Word with a manifest.xml file that points to the cloudfront endpoint I'm getting the error "Uncaught ReferenceError: React is not defined". The same error occurs when I point directly to the S3 static web endpoint. To see if I've missed anything I deployed a generic create-react-app using the steps above and it runs fine. I'm assuming that the problem lies with my webpack config so I've included that here (common, and prod). I'd be happy to include anything else that's needed. I'm also open to other deployment options if using AWS is causing the problem.



webpack.common.js:



const webpack = require('webpack');
const path = require('path');
const package = require('../package.json');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const autoprefixer = require('autoprefixer');

const build = (() =>
const timestamp = new Date().getTime();
return
name: package.name,
version: package.version,
timestamp: timestamp,
author: package.author
;
)();

const entry =
vendor: [
'react',
'react-dom',
'core-js',
'office-ui-fabric-react'
],
app: [
'react-hot-loader/patch',
'./index.tsx',
],
'function-file': '../function-file/function-file.ts'
;

const rules = [

test: /.tsx?$/,
use: [
'react-hot-loader/webpack',
'ts-loader'
],
exclude: /node_modules/
,

test: /.css$/,
use: ['style-loader', 'css-loader']
,

test: /.less$/,
use: ['style-loader', 'css-loader', 'less-loader']
,
svg
];

const output =
path: path.resolve('dist'),
publicPath: '/',
filename: '[name].[hash].js',
chunkFilename: '[id].[hash].chunk.js'
;

const WEBPACK_PLUGINS = [
new webpack.NamedModulesPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.BannerPlugin( banner: `$build.name v.$build.version ($build.timestamp) © $build.author` ),
new webpack.DefinePlugin(
ENVIRONMENT: JSON.stringify(
build: build
)
),
new webpack.LoaderOptionsPlugin(
options:
postcss: [
autoprefixer( browsers: ['Safari >= 8', 'last 2 versions'] ),
],
htmlLoader:
minimize: true


)
];

module.exports =
context: path.resolve('./src'),
entry,
output,
resolve:
extensions: ['.js', '.jsx', '.ts', '.tsx', '.scss', '.css', '.html']
,
module:
rules,
,
optimization:
splitChunks:
chunks: 'async',
minChunks: Infinity,
name: 'vendor'

,
plugins: [
...WEBPACK_PLUGINS,
new ExtractTextPlugin('[name].[hash].css'),
new HtmlWebpackPlugin(
title: 'letterConfig',
filename: 'index.html',
template: './index.html',
chunks: ['app', 'vendor', 'polyfills']
),
new HtmlWebpackPlugin(
title: 'letterConfig',
filename: 'function-file/function-file.html',
template: '../function-file/function-file.html',
chunks: ['function-file']
),
new CopyWebpackPlugin([

from: '../assets',
ignore: ['*.scss'],
to: 'assets',

])
]
;


webpack.prod.js:



const webpack = require('webpack');
const webpackMerge = require('webpack-merge');
const commonConfig = require('./webpack.common.js');
const ENV = process.env.NODE_ENV = process.env.ENV = 'development';

module.exports = webpackMerge(commonConfig,
devtool: 'source-map',

externals:
'react': 'React',
'react-dom': 'ReactDOM'
,

performance:
hints: "warning"
,

optimization:
minimize: true

);


index.tsx:



import * as React from 'react';
import * as ReactDOM from 'react-dom';
import AppContainer from 'react-hot-loader';
import initializeIcons from 'office-ui-fabric-react/lib/Icons';

import App from './components/App';

import './styles.less';
import 'office-ui-fabric-react/dist/css/fabric.min.css';

initializeIcons();

let isOfficeInitialized = false;

const title = 'letterConfig';

const render = (Component) =>
ReactDOM.render(
<AppContainer>
<Component title=title isOfficeInitialized=isOfficeInitialized />
</AppContainer>,
document.getElementById('container')
);
;

/* Render application after Office initializes */
Office.initialize = () =>
console.log('init');
isOfficeInitialized = true;
render(App);
;

/* Initial render showing a progress bar */
render(App);

if ((module as any).hot)
(module as any).hot.accept('./components/App', () =>
const NextApp = require('./components/App').default;
render(NextApp);
);










share|improve this question
























  • You should be able to host an add-in on any service. Some questions: What are the exact steps that lead to the error and where do you see the error? Are you using Office.initialize or Office.onReady? Is the React bootstrapping code inside the initialize or onReady? How are you sideloading the manifest?

    – Rick Kirkham
    Mar 6 at 17:20











  • I'm seeing the error in the console using office365. Also, just using the url in a browser shows the same error. I'm using Office.initialize, and it's bootstrapping there. I'm uisng insert->Office addins, and uploading the manifest.xml. I'll include the entire index.tsx file in the original post for clarity.

    – David Nickerson
    Mar 6 at 18:20












  • I'm still not clear on when/where you see the error. Do you have a ribbon button that opens the add-in a task pane? Is that when it errors? I don't know what "the console using office 365" means. If you comment out the line render(App) about 8 lines up from the bottom (not the one inside Office.initialize), do you still get the error? Finally, please verify that react and react-dom are in the bundle that you are hosting on AWS.

    – Rick Kirkham
    Mar 6 at 22:14













1












1








1








I have a word add in written in typescript using Officejs and office-ui-fabric-react. Everything works fine with the server running locally. I'd like to deploy into AWS S3 with Cloudfront. I'm building with npm run build, and npm run deploy (using deploy command "aws --profile profile-name s3 sync dist/ s3://bucketname". Static web site hosting is enabled in the S3 bucket. All files from the dist directory are seen in the bucket. After inserting the add in into Word with a manifest.xml file that points to the cloudfront endpoint I'm getting the error "Uncaught ReferenceError: React is not defined". The same error occurs when I point directly to the S3 static web endpoint. To see if I've missed anything I deployed a generic create-react-app using the steps above and it runs fine. I'm assuming that the problem lies with my webpack config so I've included that here (common, and prod). I'd be happy to include anything else that's needed. I'm also open to other deployment options if using AWS is causing the problem.



webpack.common.js:



const webpack = require('webpack');
const path = require('path');
const package = require('../package.json');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const autoprefixer = require('autoprefixer');

const build = (() =>
const timestamp = new Date().getTime();
return
name: package.name,
version: package.version,
timestamp: timestamp,
author: package.author
;
)();

const entry =
vendor: [
'react',
'react-dom',
'core-js',
'office-ui-fabric-react'
],
app: [
'react-hot-loader/patch',
'./index.tsx',
],
'function-file': '../function-file/function-file.ts'
;

const rules = [

test: /.tsx?$/,
use: [
'react-hot-loader/webpack',
'ts-loader'
],
exclude: /node_modules/
,

test: /.css$/,
use: ['style-loader', 'css-loader']
,

test: /.less$/,
use: ['style-loader', 'css-loader', 'less-loader']
,
svg
];

const output =
path: path.resolve('dist'),
publicPath: '/',
filename: '[name].[hash].js',
chunkFilename: '[id].[hash].chunk.js'
;

const WEBPACK_PLUGINS = [
new webpack.NamedModulesPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.BannerPlugin( banner: `$build.name v.$build.version ($build.timestamp) © $build.author` ),
new webpack.DefinePlugin(
ENVIRONMENT: JSON.stringify(
build: build
)
),
new webpack.LoaderOptionsPlugin(
options:
postcss: [
autoprefixer( browsers: ['Safari >= 8', 'last 2 versions'] ),
],
htmlLoader:
minimize: true


)
];

module.exports =
context: path.resolve('./src'),
entry,
output,
resolve:
extensions: ['.js', '.jsx', '.ts', '.tsx', '.scss', '.css', '.html']
,
module:
rules,
,
optimization:
splitChunks:
chunks: 'async',
minChunks: Infinity,
name: 'vendor'

,
plugins: [
...WEBPACK_PLUGINS,
new ExtractTextPlugin('[name].[hash].css'),
new HtmlWebpackPlugin(
title: 'letterConfig',
filename: 'index.html',
template: './index.html',
chunks: ['app', 'vendor', 'polyfills']
),
new HtmlWebpackPlugin(
title: 'letterConfig',
filename: 'function-file/function-file.html',
template: '../function-file/function-file.html',
chunks: ['function-file']
),
new CopyWebpackPlugin([

from: '../assets',
ignore: ['*.scss'],
to: 'assets',

])
]
;


webpack.prod.js:



const webpack = require('webpack');
const webpackMerge = require('webpack-merge');
const commonConfig = require('./webpack.common.js');
const ENV = process.env.NODE_ENV = process.env.ENV = 'development';

module.exports = webpackMerge(commonConfig,
devtool: 'source-map',

externals:
'react': 'React',
'react-dom': 'ReactDOM'
,

performance:
hints: "warning"
,

optimization:
minimize: true

);


index.tsx:



import * as React from 'react';
import * as ReactDOM from 'react-dom';
import AppContainer from 'react-hot-loader';
import initializeIcons from 'office-ui-fabric-react/lib/Icons';

import App from './components/App';

import './styles.less';
import 'office-ui-fabric-react/dist/css/fabric.min.css';

initializeIcons();

let isOfficeInitialized = false;

const title = 'letterConfig';

const render = (Component) =>
ReactDOM.render(
<AppContainer>
<Component title=title isOfficeInitialized=isOfficeInitialized />
</AppContainer>,
document.getElementById('container')
);
;

/* Render application after Office initializes */
Office.initialize = () =>
console.log('init');
isOfficeInitialized = true;
render(App);
;

/* Initial render showing a progress bar */
render(App);

if ((module as any).hot)
(module as any).hot.accept('./components/App', () =>
const NextApp = require('./components/App').default;
render(NextApp);
);










share|improve this question
















I have a word add in written in typescript using Officejs and office-ui-fabric-react. Everything works fine with the server running locally. I'd like to deploy into AWS S3 with Cloudfront. I'm building with npm run build, and npm run deploy (using deploy command "aws --profile profile-name s3 sync dist/ s3://bucketname". Static web site hosting is enabled in the S3 bucket. All files from the dist directory are seen in the bucket. After inserting the add in into Word with a manifest.xml file that points to the cloudfront endpoint I'm getting the error "Uncaught ReferenceError: React is not defined". The same error occurs when I point directly to the S3 static web endpoint. To see if I've missed anything I deployed a generic create-react-app using the steps above and it runs fine. I'm assuming that the problem lies with my webpack config so I've included that here (common, and prod). I'd be happy to include anything else that's needed. I'm also open to other deployment options if using AWS is causing the problem.



webpack.common.js:



const webpack = require('webpack');
const path = require('path');
const package = require('../package.json');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const autoprefixer = require('autoprefixer');

const build = (() =>
const timestamp = new Date().getTime();
return
name: package.name,
version: package.version,
timestamp: timestamp,
author: package.author
;
)();

const entry =
vendor: [
'react',
'react-dom',
'core-js',
'office-ui-fabric-react'
],
app: [
'react-hot-loader/patch',
'./index.tsx',
],
'function-file': '../function-file/function-file.ts'
;

const rules = [

test: /.tsx?$/,
use: [
'react-hot-loader/webpack',
'ts-loader'
],
exclude: /node_modules/
,

test: /.css$/,
use: ['style-loader', 'css-loader']
,

test: /.less$/,
use: ['style-loader', 'css-loader', 'less-loader']
,
svg
];

const output =
path: path.resolve('dist'),
publicPath: '/',
filename: '[name].[hash].js',
chunkFilename: '[id].[hash].chunk.js'
;

const WEBPACK_PLUGINS = [
new webpack.NamedModulesPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.BannerPlugin( banner: `$build.name v.$build.version ($build.timestamp) © $build.author` ),
new webpack.DefinePlugin(
ENVIRONMENT: JSON.stringify(
build: build
)
),
new webpack.LoaderOptionsPlugin(
options:
postcss: [
autoprefixer( browsers: ['Safari >= 8', 'last 2 versions'] ),
],
htmlLoader:
minimize: true


)
];

module.exports =
context: path.resolve('./src'),
entry,
output,
resolve:
extensions: ['.js', '.jsx', '.ts', '.tsx', '.scss', '.css', '.html']
,
module:
rules,
,
optimization:
splitChunks:
chunks: 'async',
minChunks: Infinity,
name: 'vendor'

,
plugins: [
...WEBPACK_PLUGINS,
new ExtractTextPlugin('[name].[hash].css'),
new HtmlWebpackPlugin(
title: 'letterConfig',
filename: 'index.html',
template: './index.html',
chunks: ['app', 'vendor', 'polyfills']
),
new HtmlWebpackPlugin(
title: 'letterConfig',
filename: 'function-file/function-file.html',
template: '../function-file/function-file.html',
chunks: ['function-file']
),
new CopyWebpackPlugin([

from: '../assets',
ignore: ['*.scss'],
to: 'assets',

])
]
;


webpack.prod.js:



const webpack = require('webpack');
const webpackMerge = require('webpack-merge');
const commonConfig = require('./webpack.common.js');
const ENV = process.env.NODE_ENV = process.env.ENV = 'development';

module.exports = webpackMerge(commonConfig,
devtool: 'source-map',

externals:
'react': 'React',
'react-dom': 'ReactDOM'
,

performance:
hints: "warning"
,

optimization:
minimize: true

);


index.tsx:



import * as React from 'react';
import * as ReactDOM from 'react-dom';
import AppContainer from 'react-hot-loader';
import initializeIcons from 'office-ui-fabric-react/lib/Icons';

import App from './components/App';

import './styles.less';
import 'office-ui-fabric-react/dist/css/fabric.min.css';

initializeIcons();

let isOfficeInitialized = false;

const title = 'letterConfig';

const render = (Component) =>
ReactDOM.render(
<AppContainer>
<Component title=title isOfficeInitialized=isOfficeInitialized />
</AppContainer>,
document.getElementById('container')
);
;

/* Render application after Office initializes */
Office.initialize = () =>
console.log('init');
isOfficeInitialized = true;
render(App);
;

/* Initial render showing a progress bar */
render(App);

if ((module as any).hot)
(module as any).hot.accept('./components/App', () =>
const NextApp = require('./components/App').default;
render(NextApp);
);







reactjs typescript webpack office-js






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 17:27







David Nickerson

















asked Mar 6 at 15:25









David NickersonDavid Nickerson

715




715












  • You should be able to host an add-in on any service. Some questions: What are the exact steps that lead to the error and where do you see the error? Are you using Office.initialize or Office.onReady? Is the React bootstrapping code inside the initialize or onReady? How are you sideloading the manifest?

    – Rick Kirkham
    Mar 6 at 17:20











  • I'm seeing the error in the console using office365. Also, just using the url in a browser shows the same error. I'm using Office.initialize, and it's bootstrapping there. I'm uisng insert->Office addins, and uploading the manifest.xml. I'll include the entire index.tsx file in the original post for clarity.

    – David Nickerson
    Mar 6 at 18:20












  • I'm still not clear on when/where you see the error. Do you have a ribbon button that opens the add-in a task pane? Is that when it errors? I don't know what "the console using office 365" means. If you comment out the line render(App) about 8 lines up from the bottom (not the one inside Office.initialize), do you still get the error? Finally, please verify that react and react-dom are in the bundle that you are hosting on AWS.

    – Rick Kirkham
    Mar 6 at 22:14

















  • You should be able to host an add-in on any service. Some questions: What are the exact steps that lead to the error and where do you see the error? Are you using Office.initialize or Office.onReady? Is the React bootstrapping code inside the initialize or onReady? How are you sideloading the manifest?

    – Rick Kirkham
    Mar 6 at 17:20











  • I'm seeing the error in the console using office365. Also, just using the url in a browser shows the same error. I'm using Office.initialize, and it's bootstrapping there. I'm uisng insert->Office addins, and uploading the manifest.xml. I'll include the entire index.tsx file in the original post for clarity.

    – David Nickerson
    Mar 6 at 18:20












  • I'm still not clear on when/where you see the error. Do you have a ribbon button that opens the add-in a task pane? Is that when it errors? I don't know what "the console using office 365" means. If you comment out the line render(App) about 8 lines up from the bottom (not the one inside Office.initialize), do you still get the error? Finally, please verify that react and react-dom are in the bundle that you are hosting on AWS.

    – Rick Kirkham
    Mar 6 at 22:14
















You should be able to host an add-in on any service. Some questions: What are the exact steps that lead to the error and where do you see the error? Are you using Office.initialize or Office.onReady? Is the React bootstrapping code inside the initialize or onReady? How are you sideloading the manifest?

– Rick Kirkham
Mar 6 at 17:20





You should be able to host an add-in on any service. Some questions: What are the exact steps that lead to the error and where do you see the error? Are you using Office.initialize or Office.onReady? Is the React bootstrapping code inside the initialize or onReady? How are you sideloading the manifest?

– Rick Kirkham
Mar 6 at 17:20













I'm seeing the error in the console using office365. Also, just using the url in a browser shows the same error. I'm using Office.initialize, and it's bootstrapping there. I'm uisng insert->Office addins, and uploading the manifest.xml. I'll include the entire index.tsx file in the original post for clarity.

– David Nickerson
Mar 6 at 18:20






I'm seeing the error in the console using office365. Also, just using the url in a browser shows the same error. I'm using Office.initialize, and it's bootstrapping there. I'm uisng insert->Office addins, and uploading the manifest.xml. I'll include the entire index.tsx file in the original post for clarity.

– David Nickerson
Mar 6 at 18:20














I'm still not clear on when/where you see the error. Do you have a ribbon button that opens the add-in a task pane? Is that when it errors? I don't know what "the console using office 365" means. If you comment out the line render(App) about 8 lines up from the bottom (not the one inside Office.initialize), do you still get the error? Finally, please verify that react and react-dom are in the bundle that you are hosting on AWS.

– Rick Kirkham
Mar 6 at 22:14





I'm still not clear on when/where you see the error. Do you have a ribbon button that opens the add-in a task pane? Is that when it errors? I don't know what "the console using office 365" means. If you comment out the line render(App) about 8 lines up from the bottom (not the one inside Office.initialize), do you still get the error? Finally, please verify that react and react-dom are in the bundle that you are hosting on AWS.

– Rick Kirkham
Mar 6 at 22:14












1 Answer
1






active

oldest

votes


















1














It turned out that it was looking for a globally defined "React", and so not resolving via an npm module. In the webpack.prod.js file removing the following solved the problem:



externals: 
'react': 'React',
'react-dom': 'ReactDOM'
,





share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55026597%2fdeploying-officejs-fabric-react-word-add-in%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    It turned out that it was looking for a globally defined "React", and so not resolving via an npm module. In the webpack.prod.js file removing the following solved the problem:



    externals: 
    'react': 'React',
    'react-dom': 'ReactDOM'
    ,





    share|improve this answer



























      1














      It turned out that it was looking for a globally defined "React", and so not resolving via an npm module. In the webpack.prod.js file removing the following solved the problem:



      externals: 
      'react': 'React',
      'react-dom': 'ReactDOM'
      ,





      share|improve this answer

























        1












        1








        1







        It turned out that it was looking for a globally defined "React", and so not resolving via an npm module. In the webpack.prod.js file removing the following solved the problem:



        externals: 
        'react': 'React',
        'react-dom': 'ReactDOM'
        ,





        share|improve this answer













        It turned out that it was looking for a globally defined "React", and so not resolving via an npm module. In the webpack.prod.js file removing the following solved the problem:



        externals: 
        'react': 'React',
        'react-dom': 'ReactDOM'
        ,






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 7 at 18:49









        David NickersonDavid Nickerson

        715




        715





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55026597%2fdeploying-officejs-fabric-react-word-add-in%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

            Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

            Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved