Skip to content

[2.0.0] getLocalIdent validation #862

Closed
@gpoitch

Description

@gpoitch
  • Operating System: macOS 10.14.1
  • Node Version: 11.2.0
  • NPM Version: 6.4.1
  • webpack Version: 4.27.1
  • css-loader Version: 2.0.0

Expected Behavior

Previously, if getLocalIdent returned a falsey value, css-loader would fallback to using localIdentName

Actual Behavior

css-loader throws an error:

ValidationError: CSS Loader Invalid Options
options.getLocalIdent should pass "instanceof" keyword validation

Code

const isProduction = false

const cssLoader = {
  loader: 'css-loader',
  options: {
    modules: true,
    localIdentName: '[local]__[hash:base64:3]',
    getLocalIdent: isProduction && function() {
       return 'foo' // other logic here, but just return a string for purpose of issue
    }
  }
}

How Do We Reproduce?

Run tests with those loader options

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions