Skip to content

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

Open
@vvanpo

Description

@vvanpo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions