This file contains hidden or 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
const path = require('path'); | |
const webpack = require('webpack'); | |
const NameAllModulesPlugin = require('name-all-modules-plugin'); | |
module.exports = { | |
entry: { | |
main: './src/foo', | |
other: './src/foo-two', | |
vendor: ['preact'] | |
}, |
This file contains hidden or 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
Asset Size Chunks Chunk Names | |
async-bar.js.06896d922ee7bb8af159.js 324 bytes async-bar.js [emitted] | |
async-baz.js.fff77d118cec24487e5d.js 324 bytes async-baz.js [emitted] | |
main.8fad02c2ce285a92402a.js 1.52 kB main [emitted] main | |
other.db28c745f0f45fa4d8ed.js 1.06 kB other [emitted] other | |
runtime.506eb2c73a3b28891b05.js 6.05 kB runtime [emitted] runtime | |
vendor.12a52011916cc3cb208c.js 20.8 kB vendor [emitted] vendor | |
[./node_modules/preact/dist/preact.js] ./~/preact/dist/preact.js 20.5 kB {vendor} [built] | |
[./src/async-bar.js] ./src/async-bar.js 41 bytes {async-bar.js} [built] | |
[./src/async-baz.js] ./src/async-baz.js 41 bytes {async-baz.js} [built] |
This file contains hidden or 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
// webpack.config.js | |
plugins: [ | |
//... | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: 'vendor', | |
minChunks: Infinity | |
}), | |
// ... |
This file contains hidden or 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
Asset Size Chunks Chunk Names | |
async-bar.js.06896d922ee7bb8af159.js 324 bytes async-bar.js [emitted] | |
async-baz.js.fff77d118cec24487e5d.js 324 bytes async-baz.js [emitted] | |
main.8407140a96b58ecd9a36.js 1.32 kB main [emitted] main | |
other.e86bb03c185f1e6bfc33.js 863 bytes other [emitted] other | |
runtime.da520a6c3b0dab33c4dc.js 6.05 kB runtime [emitted] runtime | |
vendor.c0d706bb45788764e72e.js 21 kB vendor [emitted] vendor | |
[./node_modules/preact/dist/preact.js] ./~/preact/dist/preact.js 20.5 kB {vendor} [built] | |
[./src/async-bar.js] ./src/async-bar.js 41 bytes {async-bar.js} [built] | |
[./src/async-baz.js] ./src/async-baz.js 41 bytes {async-baz.js} [built] |
This file contains hidden or 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
// foo-two.js | |
import bar from './bar'; | |
import preact from 'preact'; | |
import('./async-baz').then( a => console.log(a)); | |
console.log(preact.toString() + "hello world again and again"); |
This file contains hidden or 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
// webpack.config.js | |
// ... | |
entry: { | |
main: './src/foo', | |
other: './src/foo-two', | |
vendor: ['preact'] | |
}, | |
// ... |
This file contains hidden or 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
Asset Size Chunks Chunk | |
async-bar.js.06896d922ee7bb8af159.js 324 bytes async-bar.js [emitted] | |
async-baz.js.fff77d118cec24487e5d.js 324 bytes async-baz.js [emitted] | |
main.8fad02c2ce285a92402a.js 1.52 kB main [emitted] main | |
runtime.a1ba8a5ef1cf9f245e87.js 6.01 kB runtime [emitted] runtime | |
vendor.12a52011916cc3cb208c.js 20.8 kB vendor [emitted] vendor | |
[./node_modules/preact/dist/preact.js] ./~/preact/dist/preact.js 20.5 kB {vendor} [built] | |
[./src/async-bar.js] ./src/async-bar.js 41 bytes {async-bar.js} [built] | |
[./src/async-baz.js] ./src/async-baz.js 41 bytes {async-baz.js} [built] | |
[./src/bar.js] ./src/bar.js 23 bytes {main} [built] |
This file contains hidden or 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
// webpack.config.js | |
plugins: [ | |
// ... | |
{ | |
apply(compiler) { | |
compiler.plugin("compilation", (compilation) => { | |
compilation.plugin("before-module-ids", (modules) => { | |
modules.forEach((module) => { | |
if (module.id !== null) { | |
return; |
This file contains hidden or 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
// before: | |
Asset Size Chunks Chunk Names | |
async-bar.js.06896d922ee7bb8af159.js 324 bytes async-bar.js [emitted] | |
async-baz.js.fff77d118cec24487e5d.js 324 bytes async-baz.js [emitted] | |
main.e4704e563c227ee88d16.js 1.21 kB main [emitted] main | |
runtime.6add1d75139c2dd504b1.js 6.01 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] | |
[./src/async-bar.js] ./src/async-bar.js 41 bytes {async-bar.js} [built] |
This file contains hidden or 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
// webpack.config.js | |
// ... | |
externals: { | |
jquery: 'jQuery' | |
}, | |
// ... |
NewerOlder