DavidH
DavidH

Reputation: 228

Webpack css-loader does not consider localIdentName

I am using the css-loader as Webpack plugin to transform my css class name but the localIndentName option has no effect.

Here's my webpack configuration concerning the css-loader:

{
    test: /(\.css|\.scss|\.sass)$/,
    use: [
      {
        loader: 'css-loader',
        options: {
          sourceMap: true,
          module: true,
          localIndentName:'[name]_[local]_[hash:base64:5]'
        }
      }
    ]
  }

The class of my html elements are being transformed to hash value only:

<div class="_3FKNgBgNuQfnCln2xIoxoO">
   <div class="_3qj_5lUx_x_cKsHgbKmTIq"></div>
</div>

I am using the following versions:

Does someone know what I am doing wrong?

Upvotes: 1

Views: 1747

Answers (2)

vidu
vidu

Reputation: 21

Try with this way,

 modules: true,
 modules: {
       localIdentName: '[name]__[local]___[hash:base64:5]'
           }

instead of

module: true,
      localIndentName:'[name]_[local]_[hash:base64:5]'

Upvotes: 0

alexandrneo
alexandrneo

Reputation: 31

but the localIndentName option has no effect

Was dealing with same issue. Assuming there is the typo in some of the tutorials...

The options property must be localIdentName not localIndentName.

Upvotes: 2

Related Questions