我使用mini-css-extract-plugin
和。css-loader
sass-loader
CSS更改的输出:
Built at: 06/07/2019 7:37:09 PM
Asset Size Chunks Chunk Names
vendor.css 174 KiB vendor [emitted] vendor
vendor.css.map 188 KiB vendor [emitted] vendor
vendor.js 3.25 MiB vendor [emitted] [big] vendor
vendor.js.map 3.27 MiB vendor [emitted] vendor
+ 4 hidden assets
Entrypoint core [big] = vendor.css vendor.js vendor.css.map vendor.js.map core.css core.js core.css.map core.js.map
[./static/sass/base.scss] 39 bytes {core} [built]
+ 648 hidden modules
Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js?url=false&sourceMap=true!node_modules/sass-loader/lib/loader.js?&sourceMap=true!static/sass/base.scss:
Entrypoint mini-css-extract-plugin = *
[./node_modules/css-loader/dist/cjs.js?url=false&sourceMap=true!./static/css/minicolors-2.2.4.css] 195 KiB {mini-css-extract-plugin} [built]
+ 10 hidden modules
我假设这是因为 Webpack 基本上是一个 JS 捆绑器,所以 CSS 被捆绑到 JS 并将mini-css-extract-plugin
CSS 提取到一个单独的块中。那准确吗?
为什么只有我的样式发生变化时,Webpack 会重建 JS 输出文件?