When webpack uses css-loader, the problem that css-modules,localIdentName cannot read path is turned on.

  1. when webpack uses css-loader, turn on css-modules,localIdentName and cannot read path
  2. the configuration code is as follows
{
    test: /\.css$/,
    exclude: /node_modules/,
    use: [
      require.resolve("style-loader"),
      {
        loader: require.resolve("css-loader"),
        options: {
          importLoaders: 1,
          modules: true,
          localIdentName: "[path]__[name]__[local]___[hash:base64:5]",
        },
      },
      {
        loader: require.resolve("postcss-loader"),
        options: {
          // Necessary for external CSS imports to work
          // https://github.com/facebookincubator/create-react-app/issues/2677
          ident: "postcss",
          plugins: () => [
            require("postcss-flexbugs-fixes"),
            autoprefixer({
              browsers: [
                ">1%",
                "last 4 versions",
                "Firefox ESR",
                "not ie < 9", // React doesn"t support IE8 anyway
              ],
              flexbox: "no-2009",
            }),
          ],
        },
      },
    ],
  },
  {
    test: /\.css$/,
    use: [require.resolve("style-loader"), require.resolve("css-loader")],
    include: /node_modules/,
  },

the compilation result is as follows:

<div class="__style__bar___1gEOY">
    ...
</div>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31ad0-2bd97.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31ad0-2bd97.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?