Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MiniCssExtractPlugin config not work #94

Open
zhaowenjie opened this issue Mar 17, 2022 · 0 comments
Open

MiniCssExtractPlugin config not work #94

zhaowenjie opened this issue Mar 17, 2022 · 0 comments

Comments

@zhaowenjie
Copy link

plugins: [
    {
      plugin: CracoAntDesignPlugin,
      options: {
        miniCssExtractPluginOptions: {
          filename: 'hahaha/[name].[hash].css',
          chunkFilename: 'hahaha/[id].[hash].css'
        },
        lessLoaderOptions: {
          lessOptions: {
            javascriptEnabled: true,
            sourceMap: false
          }
        },
        modifyLessRule: function (lessRule) {
          return {
            ...lessRule,
            // craco-less中,配置为 /\.module\.(less)$/,导致.module.less文件无法编译,此处覆盖相关配置
            exclude: /\.nothing\.(less)$/
          }
        },
        cssLoaderOptions: {
          modules: {
            localIdentName: '[local]__[hash:base64:5]',
            // 回调必须返回 `local`,`global`  默认global
            mode: (resourcePath) => {
              if (/(module|modules|local)\.(less|css)$/i.test(resourcePath)) {
                return 'local'
              }

              return 'global'
            }
          }
        },
        babelPluginImportOptions: {
          libraryName: 'antd',
          libraryDirectory: 'es',
          style: true
        }
      }
    },
    {
      plugin: CracoAliasPlugin,
      options: { alias: configPaths('./tsconfig.paths.json') }
    }
  ]

I wanted to change the CSS output file directory, but the miniCssExtractPluginOptions configuration did not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant