Skip to content

getLocalIdent function no longer falls back to default implementation #1191

Closed
@tvsbrent

Description

@tvsbrent
  • Operating System: MacOS 10.15.6
  • Node Version: 12.18.0
  • NPM Version: 6.14.5
  • webpack Version: 4.44.2
  • css-loader Version: 4.3.0

Expected Behavior

A getLocalIdent function that return a falsy value should fallback to the defaultGetLocalIdent function found in the utils.js.

Actual Behavior

With the 4.x release of css-loader, the behavior introduced in this pull request no longer works. A custom getLocalIdent function can no longer return a falsy value and have the default getLocalIdent function invoked.

I couldn't see any other convenient work arounds, like being able to import that default function and invoking it myself in my custom function.

Code

{
  test: /\.css$/,
  use: [
    {
      loader: 'style-loader'
    },
    {
      loader: 'css-loader',
      options: {
        modules: {
          exportLocalsConvention: 'camelCase',
          getLocalIdent: () => '',
          localIdentName: '[local]--[hash:base64:5]'
        }
      }
    }
  ]
}

How Do We Reproduce?

Have a getLocalIdent function return a falsy value.

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