React : CSS class name import not working

后端 未结 15 1515
轻奢々
轻奢々 2020-12-31 20:16

i have a

div in my react component and im importing some class name from a class css file, but the class name is not getting integrated to the main
15条回答
  •  离开以前
    2020-12-31 20:42

    the other answers not worked for me so I used this solution and worked fine

    1: run the npm run eject command

    2: go to config/webpack.config.js and search for cssRegex

    3: use this code in that particular section

    test: cssRegex,
    exclude: cssModuleRegex,
    use: getStyleLoaders({
      importLoaders: 1,
      modules:{
        localIdentName:'[name]__[local]__[hash:base64:5]'
      },
    }),
    

提交回复
热议问题