Vendor and code splitting in webpack 2
Adam Rackis
1.7K17

Thank you for your useful tutorial!

I tried the configurations you propose, adapted to my project, but I had some problems (maybe because the CommonsChunkPlugin has changed its interfaces since you wrote this).

i.e. I have this error when I try to use “filename” option in your “used-twice” CommonsChunkPlugin istance.

throw new Error(`You can not specify a filename if you use the \”async\” option.
 ^

Error: You can not specify a filename if you use the “async” option.
You can however specify the name of the async chunk by passing the desired string as the “async” option.
 at CommonsChunkPlugin.normalizeOptions (/media/RIPOSTIGLIO/git/musement.com/node_modules/webpack/lib/optimize/CommonsChunkPlugin.js:63:10)
 at new CommonsChunkPlugin (/media/RIPOSTIGLIO/git/musement.com/node_modules/webpack/lib/optimize/CommonsChunkPlugin.js:27:34)
 at Object.<anonymous> (/media/RIPOSTIGLIO/git/musement.com/build/webpack.client.js:78:5)
 at Module._compile (module.js:569:30)
 at Object.Module._extensions..js (module.js:580:10)
 at Module.load (module.js:503:32)
 at tryModuleLoad (module.js:466:12)
 at Function.Module._load (module.js:458:3)
 at Module.require (module.js:513:17)
 at require (internal/module.js:11:18)
 at module.exports (/media/RIPOSTIGLIO/git/musement.com/webpack.config.js:2:10)
 at requireConfig (/media/RIPOSTIGLIO/git/musement.com/node_modules/webpack/bin/convert-argv.js:102:15)
 at /media/RIPOSTIGLIO/git/musement.com/node_modules/webpack/bin/convert-argv.js:109:17
 at Array.forEach (native)
 at module.exports (/media/RIPOSTIGLIO/git/musement.com/node_modules/webpack/bin/convert-argv.js:107:15)
 at Object.<anonymous> (/media/RIPOSTIGLIO/git/musement.com/node_modules/webpack/bin/webpack.js:153:40)