Skip to content

webpack2 - hash and path differ in css loader and bablerc #33

Closed
@danikenan

Description

@danikenan

According to closed issue #4 generateScopedName should be added to .babelrc and its value should match the localIdentName of the css-loader.

However, when using the exact same value proposed there [path]___[name]__[local]___[hash:base64:5] for both, the value is not the same. The class on the element and the generated class name are not the same. Both the path and the hash parts of the strings differ, so the style is not applied.

The html element is:

<div class="src-collectors-containers-___Collectors__root___3x28u">test</div>

But the class in the style tag is:

.collectors-containers-___Collectors__root___2F0Qi {
  color: red; 
}

My webpack reads:

rules: [{
        test: /\.scss$/,
        loaders: [
          'style?sourceMap',
          'css?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]',
          'resolve-url',
          'sass?sourceMap'
        ]
      }
]

and my babelrc reads:

plugins: [
            [
              'react-css-modules',
              {
                generateScopedName: '[path]___[name]__[local]___[hash:base64:5]' 
              }
            ],
          ]

Just as in the examples, but it does not work.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions