I can't seem to get source maps to work with the mini-css-extract-plugin
. I had them working with style-loader
.
devtool: argv.mode === 'development' ? 'eval' : 'none',
[...]
test: /\.scss$|\.css$/i,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {sourceMap: argv.mode === 'development', hmr: argv.hot},
},
{
loader: 'css-loader',
options: {sourceMap: argv.mode === 'development', importLoaders: 1},
},
[...]
plugins: [
[...]
new MiniCssExtractPlugin({
filename: argv.mode === 'development' ? '[name].css' : '[contenthash].css',
chunkFilename: argv.mode === 'development' ? '[id].css' : '[contenthash].css',
}),
]
A bit of brackground information:
I've always used the style-loader
to get hot module replacement to work in dev mode and mini-css-extract-plugin
for production.
Now the mini-css-extract-plugin
supports hmr which is awesome since i won't have to deal with FOUC in development anymore.
But having no source map to at least tell me from which file a style is coming from is annoying.