项目作者: carloluis

项目描述 :
webpack-4 optimizations
高级语言: JavaScript
项目地址: git://github.com/carloluis/webpack-optimization-splitchunks.git
创建时间: 2018-03-12T00:30:35Z
项目社区:https://github.com/carloluis/webpack-optimization-splitchunks

开源协议:MIT License

下载


webpack-optimization-splitchunks

This playground project is based on webpack-splitchunks-playground

Webpack 4 optimization.splitChunks playground…

Tests

Project code structure:

  1. src
  2. ├── bundles
  3. ├── a.js
  4. ├── b.js
  5. ├── core-a.js
  6. └── core-b.js
  7. ├── core-module-a.js
  8. ├── core-module-b.js
  9. ├── non-core-module-a.js
  10. └── non-core-module-b.js


#### Minimum Config

> Using webpack.config.entry.js to specify entypoints

bash npm run build:entry

Hash: 09cb46e3e80b0d3d7bba Version: webpack 4.1.1 Time: 98ms Built at: 3/11/2018 11:44:49 PM Asset Size Chunks Chunk Names coreA.bundle.js 3.62 KiB 0 [emitted] coreA coreB.bundle.js 3.64 KiB 1 [emitted] coreB a.bundle.js 4.33 KiB 2 [emitted] a b.bundle.js 4.35 KiB 3 [emitted] b Entrypoint coreA = coreA.bundle.js Entrypoint coreB = coreB.bundle.js Entrypoint a = a.bundle.js Entrypoint b = b.bundle.js

#### Split Chunks optimization

> Using webpack.config.js (configure optimization property)

bash npm run build

```
Hash: 01d77365c8faf3592a82
Version: webpack 4.1.1
Time: 104ms
Built at: 3/12/2018 12:10:52 AM
Asset Size Chunks Chunk Names
coreA.bundle.js 5.67 KiB 0 [emitted] coreA
coreB.bundle.js 5.67 KiB 1 [emitted] coreB
a.bundle.js 6.28 KiB 2 [emitted] a
b.bundle.js 6.28 KiB 3 [emitted] b
vendors.bundle.js 418 bytes 4 [emitted] vendors
a~b~coreA.bundle.js 163 bytes 5 [emitted] a~b~coreA
a~b~coreB.bundle.js 163 bytes 6 [emitted] a~b~coreB
Entrypoint coreA = vendors.bundle.js a~b~coreA.bundle.js coreA.bundle.js
Entrypoint coreB = vendors.bundle.js a~b~coreB.bundle.js coreB.bundle.js
Entrypoint a = vendors.bundle.js a~b~coreA.bundle.js a~b~coreB.bundle.js a.bundle.js
Entrypoint b = vendors.bundle.js a~b~coreA.bundle.js a~b~coreB.bundle.js b.bundle.js
````

License

MIT © Carloluis