-
-
Notifications
You must be signed in to change notification settings - Fork 607
Closed
Description
Documentation Is:
- Missing
- Needed
- Confusing
- Not Sure?
Please Explain in Detail...
I found the webpack config example in README.md about line 1080 contains some abuses that can cause webpack reports an error:
Uncaught:
ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.module.rules[0].use[3] has an unknown property 'test'. These properties are valid:
object { ident?, loader?, options? }
Your Proposal for Changes
README.md#L1080
**webpack.config.js**
```js
module.exports = {
module: {
rules: [
{
// For CSS modules
// For pure CSS - /\.css$/i,
// For Sass/SCSS - /\.((c|sa|sc)ss)$/i,
// For Less - /\.((c|le)ss)$/i,
test: /\.((c|sa|sc)ss)$/i,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
// Run `postcss-loader` on each CSS `@import`, do not forget that `sass-loader` compile non CSS `@import`'s into a single file
// If you need run `sass-loader` and `postcss-loader` on each CSS `@import` please set it to `2`
importLoaders: 1,
// Automatically enable css modules for files satisfying `/\.module\.\w+$/i` RegExp.
modules: { auto: true },
},
},
{
loader: 'postcss-loader',
options: { plugins: () => [postcssPresetEnv({ stage: 0 })] },
},
// Can be `less-loader`
// The `test` property should be `\.less/i`
{
- test: /\.s[ac]ss$/i,
+ // This `test` key is invalid in Rule#UseEntry, recommend to
+ // delete this line and comment together with `For CSS modules...` above
+ // test: /\.s[ac]ss$/i,
loader: 'sass-loader',
},
],
},
...Metadata
Metadata
Assignees
Labels
No labels