Closed
Description
Following your instructions given in this issue...
- Operating System: Debian Buster
- Node Version: 14.7.0
- NPM Version: 6.14.7
- webpack Version: 4.44.1
- css-loader Version: 4.2.1
Expected Behavior / Situation
Run webpack
with the following configuration, ie. containing an inline - string - definition of css-loader
that contains number as value for importLoaders
:
module.exports = {
// ...
module: { rules: [{
test: /\.css$/,
use: ['style-loader', 'css-loader?importLoaders=1', 'postcss-loader'],
}] },
// ...
Actual Behavior / Situation
Error thrown:
ValidationError: Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
- options.importLoaders should be one of these:
boolean | integer
-> Enables/Disables or setups number of loaders applied before CSS loader (https://github.com/webpack-contrib/css-loader#importloaders).
Details:
* options.importLoaders should be a boolean.
* options.importLoaders should be a integer.
Modification Proposal
Line 133 in 8353353
// ...
{
"type": "integer"
+ },
+ {
+ "type": "string"
}
]
},
// ...
Line 225 in 8353353
: loaderContext.sourceMap,
- importLoaders: rawOptions.importLoaders,
+ importLoaders: parseInt(rawOptions.importLoaders),
esModule:
typeof rawOptions.esModule === 'undefined' ? true : rawOptions.esModule,
};
Metadata
Metadata
Assignees
Labels
No labels