optimize-css-assets-webpack-plugin
optimize-css-assets-webpack-plugin copied to clipboard
It's totally not obvious how to make source maps work
Wrong:
new OptimizeCssAssetsPlugin({cssProcessorOptions: {map: true}})
Correct:
new OptimizeCssAssetsPlugin({cssProcessorOptions: {map: {inline: false, annotations: true}}})
Since with optimize-css-assets-webpack-plugin
map
is supposed to be an object. More info here.
At least this much is worth mentioning in the README
,
Thanks for sharing this! I was struggling on the same problem since a couple of hours.
Nevertheless, there is a typo in the annotations
parameter provided to PostCSS (see https://github.com/postcss/postcss/blob/master/docs/source-maps.md)
The correct solution is:
new OptimizeCssAssetsPlugin({cssProcessorOptions: {map: {inline: false, annotation: true}}})
Everything now works correctly! Thank you