欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

如何顺利地在umi中导入和使用css与less文件

最编程 2024-02-19 13:16:15
...

umi使用CSS Modules是为了防止全局样式污染,如果想直接引用css或less,只需要在umirc.js配置:

export default {
  // other settings
  plugins: [
    // ref: https://umijs.org/plugin/umi-plugin-react.html
    ['umi-plugin-react', {
      antd: true,
      dva: true,
      dynamicImport: false,
      title: 'ytbusiness',
      dll: false,
      routes: {
        exclude: [
          /models\//,
          /services\//,
          /model\.(t|j)sx?$/,
          /service\.(t|j)sx?$/,
          /components\//,
        ],
      },
    }],
  ],
  cssLoaderOptions: {
    localIdentName:'[local]',  // 配置这行
  }
}