Skip to content

Temporary fix for those have trouble with newer version of webpack / css-loader. #304

Description

@x6ncraft

It turns out that babel-plugin-react-css-modules is using generic-names v2, which is different a bit with newer Webpack in the [hash].

generic-names v3 solve it. see this update.

So we can manually replace the generateScopedName with createGenerator from generic-names v3.

Like this

const createGenerator = require('generic-names');

const plugins = [
  [
    'babel-plugin-react-css-modules',
    {
      generateScopedName: createGenerator('[name]__[local]_[hash:base64:5]'),
      exclude: 'node_modules',
    },
  ],
];

I've done this in my own project and it works fine. Have a try. Best wishes~

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions