Answer the question
In order to leave comments, you need to log in
Why did the total build size increase after the selection of the library code?
Added the following code to webpack.config.js to separate libraries into a separate bundle:
var fs = require('fs');
var package = JSON.parse(fs.readFileSync('./package.json','utf-8'));
var vendor = [];
for (var name in package.dependencies) {
vendor.push(name);
}
module.exports = {
entry: {
app: './src/main.js',
vendor: vendor
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor'
})
]
}
Asset Size Chunks Chunk Names
app.build.js 50.6 kB 0 [emitted] app
vendor.build.js 711 kB 1 [emitted] [big] vendor
style.css 53 kB 0, 1 [emitted] app, vendor
Asset Size Chunks Chunk Names
app.build.js 536 kB 0 [emitted] [big] app
vendor.build.js 1.44 kB 1 [emitted] vendor
style.css 192 kB 0 [emitted] app
Answer the question
In order to leave comments, you need to log in
I suspect that not all dependencies packages are actually used.
In the first case, you forcibly added everything to the assembly, and in the second, the webpack collected only what you need
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question