Reputation: 39
{ test: cssRegex,
exclude: cssModuleRegex,
use: getStyleLoaders({
importLoaders: 1,
//sourceMap: isEnvProduction && shouldUseSourceMap,
modules: true,
localIdentName: '[name]__[local]__[hash:base64:5]'
}),
sideEffects: true,
},
I tried the above code but I got the error as:
Failed to compile
./src/index.css (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-3-1!./node_modules/postcss-loader/src??postcss!./src/index.css)
ValidationError: Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'localIdentName'. These properties are valid:
object { url?, import?, modules?, sourceMap?, importLoaders?, localsConvention?, onlyLocals? }
Please guide me to resolve this issue.
Upvotes: 1
Views: 866
Reputation: 150
Your getStyleLoaders() function looks like:
use: getStyleLoaders({
importLoaders: 1,
sourceMap: isEnvProduction && shouldUseSourceMap,
modules: {
mode: "local",
localIdentName: "[name]__[local]__[hash:base64:5]"
}
})
This resolve issue for me.
my 'css-loader' version is:
"css-loader": "3.4.2",
Upvotes: 0
Reputation: 19772
Change the modules
options to:
{ test: cssRegex,
exclude: cssModuleRegex,
use: getStyleLoaders({
importLoaders: 1,
//sourceMap: isEnvProduction && shouldUseSourceMap,
modules: {
mode: "local",
localIdentName: "[name]__[local]__[hash:base64:5]"
}
}),
sideEffects: true,
},
Upvotes: 3