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

bug: 在dumi中我配置chainWebpack,打包编译时,将less转出css,但是打包产物没有生效。 #2061

Closed
Lands-1203 opened this issue Mar 27, 2024 · 2 comments

Comments

@Lands-1203
Copy link

Version

"dumi": "^2.2.16",

OS Version

windows11

Node.js Version

v16.20.0

Browser Version

Link to minimal reproduction

Steps to reproduce

  chainWebpack(memo, { env, webpack }) {
    console.log('加载个性化配置');

    // 替换 style-loader 为 MiniCssExtractPlugin.loader
    memo.module
      .rule('less')
      .test(/\.less$/)
      .use('mini-css-extract-plugin-loader')
      .loader(MiniCssExtractPlugin.loader)
      .end()
      .use('css-loader')
      .loader(require.resolve('css-loader'))
      .end()
      .use('less-loader')
      .loader(require.resolve('less-loader'))
      .options({
        lessOptions: {
          javascriptEnabled: true,
        },
      });

    // 添加 MiniCssExtractPlugin 插件
    memo.plugin('mini-css-extract-plugin').use(
      new MiniCssExtractPlugin({
        filename: '[name].css',
        chunkFilename: '[id].css',
      }),
    );
  },

What is expected?

希望将less转换成css

What is actually happening?

编译完成后less没有转换成css

Any additional comments? (optional)

No response

@Lands-1203
Copy link
Author

Snipaste_2024-03-27_14-30-36

@Lands-1203
Copy link
Author

需要再fatherrc中配置

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

No branches or pull requests

1 participant