output: {
filename: '[name]-[chunkhash].js',
chunkFilename: '[name]-[chunkhash].js',
path: path.join(__dirname, 'assets/dist'),
libraryTarget: 'umd',
library: 'lib',
umdNamedDefine: true,
publicPath: '/'
},
externals:{
'react': {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react'
},
'jquery': {
root: 'jQuery',
commonjs2: 'jquery',
commonjs: 'jquery',
amd: 'jquery'
},
'react-dom':{
root:'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd:'react-dom'
}
},
resolve:{
alias:{
react:path.join(node_modules,'./react/dist/react.min.js'),
jquery:path.join(node_modules,'./jquery/dist/jquery.min.js'),
'react-dom':path.join(node_modules,'./react-dom/dist/react-dom.min.js')
}
},
module: {
noParse:[
path.join(node_modules,'./react/dist/react.min.js'),
path.join(node_modules,'./jquery/dist/jquery.min.js'),
path.join(node_modules,'./react-dom/dist/react-dom.min.js')
],
loaders: [
{
test: /[\.jsx|\.js]$/,
exclude: /node_modules/,
loader: 'babel',
presets: [
'react',
'es2015'
],
query: {
cacheDirectory: true
}
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader")
}, {
test: /\.less$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader")
}, {
test: /\.(png|jpg|gif)$/,
loader: 'url-loader?limit=8192&name=./images/[name]-[hash].[ext]'
}, {
test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,
loader: 'file?name=./font/[name]-[hash].[ext]'
}, {
test: /\.json$/,
loader: 'json'
}]
},
Uncaught ReferenceError: __WEBPACK_EXTERNAL_MODULE_2__ is not defined external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}:1