我有以下webpack配置:
规则:
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
sourceMap: false
}
}, {
loader: 'sass-loader',
options: {
sourceMap: false,
processCssUrls: false
}
}
]
}
插件:
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css'
})
使用SpeedMeasurePlugin
构建和观看输出时,我得到了这样的输出:
mini-css-extract-plugin, and
css-loader, and
sass-loader took 12.73 secs
module count = 1
css-loader, and
sass-loader took 12.66 secs
module count = 1
为什么sass编译两次?
答案 0 :(得分:0)
它是MiniCssExtractPlugin两次运行sass-loader。不知道为什么。
答案 1 :(得分:0)
这不是 MiniCSSExtractPlugin 的问题。它来自速度测量插件。
参考:https://github.com/webpack-contrib/mini-css-extract-plugin/issues/439