Here is my webpack configuration file , im getting this error on loading the html’s containing both p1.chunk and p2.chunk
var commonResourcePlugin = require(‘webpack/lib/optimize/CommonsChunkPlugin’)
module.exports = {
entry: {
p1: './js/components/character/main-character.jsx',
p2: './js/components/character/character_template/character_template_entry.jsx'
},
output: {
filename: './js/[name].chunk.js'
},
externals: {
"jquery": "jQuery",
"$": "$",
"React": "React"
},
module: {
loaders: [
{
test: /\.jsx$/,
loader: 'jsx-loader'
} // loaders can take parameters as a querystring
]
},
resolve: {
extensions: ['', '.js', '.json', '.coffee', 'jsx']
},
plugins: [
new commonResourcePlugin("./js/commons.chunk.js");
]
};
Had missed out on adding commons.chunk.js before loading the chunks , its working now !
@sjelfull I think it means the loading order of your app and vendor files in your html. I had this problem and I realised that my
<script src='app.js'>
was before<script src='vendor.js'>
. Switching orders fixed it.I have understanded.
because we use
webpack.optimize.CommonsChunkPlugin
plugin but not follow inhtml file
。Need to introduce public JS files in the HTML page, like this: