如何仅对.mod.css文件启用CSS模块? Nextjs

问题描述 投票:0回答:1

我在项目.css文件和.mod.css文件中使用了两种样式文件。我只想为扩展名为*.mod.css的文件启用CSS模块。

我的next.config.js文件

const withCSS = require('@zeit/next-css')

module.exports = withCSS({
      cssModules:true,
      cssLoaderOptions: {
        localIdentName: "[local]_[hash:base64:5]",
      },
      webpack(config, options) {
        config.module.rules.push({
          test: /\.mod.css$/,
        })
        return config
      }
})

我在项目.css文件和.mod.css文件中使用两种样式文件。我只想为扩展名为* .mod.css的文件启用CSS模块。我的next.config.js文件const ...

webpack next.js css-modules
1个回答
0
投票

事实上,withCss next的插件定义了css加载程序,您需要对其进行[[modify

© www.soinside.com 2019 - 2024. All rights reserved.