The following configuration will create client.js and vendors.js.
example
Entry
entry: {
'client': './client.js',
'vendors' ['jquery' , 'react']
}
Plugin
new CommonsChunkPlugin({
name: 'client',
minChunks: Infinity
}),
new CommonsChunkPlugin({
name: 'vendors',
chunks: ['client'],
minChunks: Infinity
})
To make it work, I need to add the client.js and vendor.js files in the HTML, otherwise i will get the error: Uncaught ReferenceError: webpackJsonp is not defined.
How can I include only the client.js file in the index.html and make it require the vendors.js file automatically?
I would like to obtain the same behaviour that I get when I split the code with require.ensure.