I'm trying to update css-loader from 3.6.0 to 4.2.2. My previous configuration was like this:
{
test: /\.css$/,
exclude: [/node_modules/, /other.css/],
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: {
modules: true,
importLoaders: 1,
localsConvention: 'camelCase',
},
},
'postcss-loader',
],
}
With the update of the library I start to got the error that localsConvention wasn't a possible option. So following the documentation I changed my options to this:
{
test: /\.css$/,
exclude: [/node_modules/, /other.css/],
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: {
modules: {
compileType: 'module',
mode: 'local',
auto: true,
exportGlobals: true,
namedExport: true,
exportLocalsConvention: 'camelCaseOnly',
exportOnlyLocals: true,
},
importLoaders: 1,
},
},
'postcss-loader',
],
}
And I started to have this error:
What am I doing wrong?
It looks like you just deleted our lovely crafted issue template. It was there for good reasons. Please help us solving your issue by answering the questions asked in this template. I'm closing this. Please either update the issue with the template and reopen, or open a new issue.
ExtractTextPlugin was deprecated, please migrate on mini-css-extract-plugin
I confirm the problem was the deprecated library!
Thank you very much for the fast answer and sorry I deleted the template 馃檹
Thanks!
Migrated from:
plugins: [new ExtractTextPlugin('[name].[chunkhash].css')]
{
...
use: ExtractTextPlugin.extract({
use: ['css-loader', 'postcss-loader', 'sass-loader'],
fallback: 'style-loader',
}),
...
}
to
plugins: new MiniCssExtractPlugin({ filename: '[name].[chunkhash].css' }),
{
...
use: [MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader', 'sass-loader'],
...
}
And now it works with 4.2.2
Most helpful comment
It looks like you just deleted our lovely crafted issue template. It was there for good reasons. Please help us solving your issue by answering the questions asked in this template. I'm closing this. Please either update the issue with the template and reopen, or open a new issue.
ExtractTextPluginwas deprecated, please migrate onmini-css-extract-plugin