Hey all,
First time creating a Bug Report so sorry if I have missed anything.
When in production mode and optimization is set to false like so:
optimization: {
minimize: false
}
CSS should not be minified
When in production mode and optimization is set to false like so:
optimization: {
minimize: false
}
CSS is minified
https://gist.github.com/lukehillonline/90bff2bca8a2f3306408624aa9e6ce55
I have created a github repo where you can reproduce the issue:
https://github.com/lukehillonline/css-loader-optimization-test
Once downloaded install all packages.
To test, first, run "start" to see a non minified version, second, run "build" to see a minified version despite the "minimize: false" flag being set.
No, you should use plugin for minimize CSS https://github.com/NMFR/optimize-css-assets-webpack-plugin, minimize out of scope loader
Hey @evilebottnawi,
Thanks for coming back, I believe you have misunderstood. I completely agree with you, minimzing CSS should be controlled by a plugin like Optimize CSS Asset Webpack Plugin.
If you look at the case I have produced there is no plugins for CSS minification and minimize: false is set, and still the CSS is minified in production mode.
From my testing I believe that css-loader is performing this minification.
maybe you use old version of css-loader
@evilebottnawi I am using css-loader v3.1.0.
When installing with yarn by using the following command:
yarn add -D css-loader v3.1.0 is the latest installed version.
You can look css-loader code and find we don't use minimizer nowhere, you need investigate who minimize you code
I ran into exactly the same problem.
sass-loader -> postcss-loader -> css-loader -> mini-css-extract-plugin
I don't know which link went wrong.
To solve!
The problem is the outputStyle option of sass-loader(node-sass),
I need to adjust the webpack configuration,
...
{
loader: 'sass-loader',
options: {
sourceMap: true,
sassOptions: {
// https://github.com/sass/node-sass#outputstyle
outputStyle: 'expanded'
}
}
}
...
Most helpful comment
To solve!
The problem is the outputStyle option of sass-loader(node-sass),
I need to adjust the webpack configuration,