Created
August 17, 2017 08:34
-
-
Save alexvcasillas/66b0f2f35a3871590be721480e61ca25 to your computer and use it in GitHub Desktop.
Webpack CommonChunks Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CommonChunkPlugin Configuration | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: 'vendors', | |
filename: '[hash].vendors.js', | |
minChunks: function(module, count) { | |
// this assumes your vendor imports exist in the node_modules directory | |
// and appears at least in two files | |
console.log(`Module: ${module.resource} ${count} times`); // DEBUG Purposes | |
return ( | |
module.context && | |
module.context.indexOf('node_modules') !== -1 && | |
count === 2 | |
); | |
} | |
// Got this when processing a module | |
Module: undefined 1 times | |
// Is that maybe the source of the error? | |
Error: No code sections found | |
at Bundle.validate (D:\webpack\demo\node_modules\inspectpack\lib\models\bundle.js:43:11) | |
at Immediate.setImmediate (D:\webpack\demo\node_modules\inspectpack\lib\models\bundle.js:268:14) | |
at runCallback (timers.js:672:20) | |
at tryOnImmediate (timers.js:645:5) | |
at processImmediate [as _immediateCallback] (timers.js:617:5) | |
D:\webpack\demo\node_modules\inspectpack\lib\models\bundle.js:43 | |
throw new Error("No code sections found"); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment