So When I try to split my application into 1 application.js file and 1 libraries.js file, everything works fine. When I try to split it up into 1 application.js file and 2 libraries.js files, I get this error when building:
ERROR in CommonsChunkPlugin: While running in normal mode it's not allowed to use a non-entry chunk (libraries-react)
Anyone know what might be causing this error?
My configuration for webpack is
var webpack = require("webpack");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var extractSass = new ExtractTextPlugin('main.css');
module.exports = {
module: {
loaders: [{
test: /\.jsx$/,
loader: 'babel',
exclude: ['./node_modules'],
query: {
presets: ['react', 'es2015']
}
}, {
test: /\.scss$/,
loader: extractSass.extract(['css', 'sass'])
}, {
test: /\.html$/,
loader: 'file?name=[name].[ext]'
}, {
test: /\/misc\/.*\.js$/,
loader: 'file?name=/misc/[name].[ext]'
}, {
test: /\.(png|jpg|jpeg|)$/,
loader: 'file?name=/images/[name].[ext]'
}]
},
plugins: [
extractSass,
new webpack.optimize.CommonsChunkPlugin('libraries-core', 'libraries-core.js'),
new webpack.optimize.CommonsChunkPlugin('libraries-react', 'libraries-react.js')
],
entry: {
//3rd party libraries
'libraries-core': [
'lodash',
'superagent',
'bluebird',
'eventemitter3',
'object-assign',
'schema-inspector',
'jsuri',
'store-cacheable',
'immutable'
],
'libraries-react': [
'react',
'react-dom',
'react-router',
'nucleus-react'
],
//application code
application: './web/app/application.jsx',
//mocks
'mocked-api': './web/app/mock/api.js',
'mocked-local-storage': './web/app/mock/local-storage.js'
},
output: {
path: './web/build',
publicPath: '/build',
filename: '[name].js'
}
}