我使用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输出文件?