Skip to content

CSS modules documentation uses invalid css-loader options object #1788

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
vvanpo opened this issue Jan 27, 2021 · 0 comments · May be fixed by #1909
Open

CSS modules documentation uses invalid css-loader options object #1788

vvanpo opened this issue Jan 27, 2021 · 0 comments · May be fixed by #1909

Comments

@vvanpo
Copy link

vvanpo commented Jan 27, 2021

Version

16.1.2

Reproduction link

https://vue-loader.vuejs.org/guide/css-modules.html#usage

Steps to reproduce

Using Webpack 5 and css-loader 5, follow the CSS modules documentation found at https://vue-loader.vuejs.org/guide/css-modules.html#usage by giving your CSS module rule the following UseEntry:

{
  loader: 'css-loader',
  options: {
    modules: true,
    localIdentName: '[local]_[hash:base64:8]'
  }
}

What is expected?

The Webpack build passes without error.

What is actually happening?

ModuleBuildError: Module build failed (from ../node_modules/css-loader/dist/cjs.js):
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?, esModule? }

The css-loader documentation for localIdentName (https://github.com/webpack-contrib/css-loader#localidentname) requires that it is nested within modules within the options object. AFAIK this has been true since the option's inception.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
1 participant