Generating a Baseline Build
為了 demo 最小化處理,可以先安裝 React:
npm i react --save
然後在專案裡導入:
app/index.js
require('react');
...
接著執行 npm run build,可以看到還沒最小化處理的檔案大小:
[webpack-validator] Config is valid.
Hash: dde0419cac0674732a83
Version: webpack 1.13.0
Time: 1730ms
Asset Size Chunks Chunk Names
app.js 133 kB 0 [emitted] app
app.js.map 157 kB 0 [emitted] app
index.html 157 bytes [emitted]
[0] ./app/index.js 123 bytes {0} [built]
[37] ./app/component.js 136 bytes {0} [built]
+ 36 hidden modules
Child html-webpack-plugin for "index.html":
+ 3 hidden modules
可以看到 app.js 高達 133 kB,其實蠻大的。