optimize-css-assets-webpack-plugin
optimize-css-assets-webpack-plugin copied to clipboard
Can't change source-maps style (Webpack Devtool settings)
Hi there!
I've notice that output source maps style doesn't respect webpack devtool settings when using this plugin.
While using css nano with post-css loader, source maps style perfectly match webpack configuration.
So I guess this issue is due to your plugin.
Thanks for you help!
Cheers
I have the same problem.
When i use mini-css-extract-plugin plugin, even if pass sourceMap=true in css-loader, source maps are not output
I resolved this problem by pass some options
new OptimizeCSSAssetsPlugin({
cssProcessorOptions: {
map: { inline: false }
}
})
Hi @code-mcx ,
I'm not saying source maps are not output ! (already configured the plugin as you suggest)
The problem is how source map are actually output.
Webpack offer different styles of source maps for production:
- cheap-source-map
- cheap-module-source-map
- source-map
- hidden-source-map
- nosources-source-map
But changing this setting doesn't affect source map style when using this plugin!
This is a problem when you want to hide your source code while keeping all advantages of source map on a production server.
@jimblue I'am sorry about i misunderstand your meaning.
I've just faced the same issue!
Sourcemaps got removed on minimization until I set the cssProcessorOptions.
However even with a working sourceMap I've got the same problem as @jimblue:
My settings for devtool are not considered.
I'm using nosources-source-map in production to hide my source code but when I use OptimizeCSSAssetsPlugin the whole sources are included in the map :(
@NMFR are there any plans to fix/improve this?
I've been able now to achieve my nosource-source-map by setting sourcesContent: false in the options.
However the sourcemap origin paths are now different:
- without
OptimizeCSSAssetsPluginit's likewebpack:///./node_modules/example/abc.scss - with
OptimizeCSSAssetsPluginit's likehttp://localhost:3030/Users/kfalkowski/myproject/assets/src/scss/app.scss
Still not happy with the result :/ I just want the minimization without touching the sourcemap. So far it seems using cssnano via the postcss-loader is the only way to achieve this.
Hey @NMFR, can we have your input about this issue!! Thanks 😃
Hi, sorry i don't have much time lately to work on this. I will take a look but i cant promise when. If you can and wish to help fell free to open a PR.
@NMFR Removing Sourcemaps in Production is pretty much a good feature.
cssProcessorOptions: {
map: false
},
This works somehow.
+1, would be great for this to respect the devtool setting!
Related to #91 and https://github.com/NMFR/optimize-css-assets-webpack-plugin/issues/53#issuecomment-494830816.