Skip to content

Instantly share code, notes, and snippets.

// somewhere in the vendor.0da51f051fcf235d7027.js
// ...
chunkId + "." + {"0":"91022729b32987083f0d"}[chunkId]
// ...
// webpack.config.js
// ...
plugins: [
// ...
new webpack.optimize.CommonsChunkPlugin({
name: ['runtime']
})
]
Asset Size Chunks Chunk Names
vendor.634878b098e5c599febd.js 20.7 kB 0 [emitted] vendor
main.d59c6ff3126e3943c563.js 538 bytes 1 [emitted] main
runtime.25ce0c546aab71f8eac5.js 5.92 kB 2 [emitted] runtime
[0] ./~/preact/dist/preact.js 20.5 kB {0} [built]
[1] ./src/foo.js 93 bytes {1} [built]
[2] multi preact 28 bytes {0} [built]
// foo.js
import bar from './bar';
// ...
Asset Size Chunks Chunk Names
main.cec87b856171489c2719.js 811 bytes 0 [emitted] main
vendor.73db375ed475c718163f.js 20.7 kB 1 [emitted] vendor
runtime.93b41beba42ebff23af0.js 5.92 kB 2 [emitted] runtime
[0] ./~/preact/dist/preact.js 20.5 kB {1} [built]
[1] ./src/bar.js 23 bytes {0} [built]
[2] ./src/foo.js 118 bytes {0} [built]
[3] multi preact 28 bytes {1} [built]
// weback.config.js
// ...
plugins: [
new webpack.NamedChunksPlugin(),
// ...
// ...
// old vendor build
// ...
/***/ }),
/* 1 */,
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
// ...
// vendor build with new import
// webpack.config.js
// ...
plugins: [
new webpack.NamedModulesPlugin(),
// ...
// ...
// output without bar.js
Asset Size Chunks Chunk Names
main.5f15e6808c8037c8bdbc.js 628 bytes main [emitted] main
runtime.72ef2fc7d9df236c7f1c.js 5.94 kB runtime [emitted] runtime
vendor.73c86187abcdf9fd7b18.js 20.7 kB vendor [emitted] vendor
[./node_modules/preact/dist/preact.js] ./~/preact/dist/preact.js 20.5 kB {vendor} [built]
[0] multi preact 28 bytes {vendor} [built]
[./src/foo.js] ./src/foo.js 121 bytes {main} [built]
// foo.js
import('./async-bar').then( a => console.log(a));
// ...