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

next-plugin-antd-less可以使用thread-loader加快构建吗 #113

Open
3sang opened this issue Jan 4, 2024 · 0 comments
Open

next-plugin-antd-less可以使用thread-loader加快构建吗 #113

3sang opened this issue Jan 4, 2024 · 0 comments

Comments

@3sang
Copy link

3sang commented Jan 4, 2024

因为自己的项目里速度分析中less-loader速度很慢,想使用thread-loader加快构建速度,但是没有看到可以使用的方式,自行尝试时一直报错。
`我自行尝试想要在less-loader前加上thread-loader,所以写了以下代码想看一下less-loader的位置,但是输出出来都是sass-loader,不知道为什么找不到less-loader,麻烦指点谢谢!

const withConsole = (nextConfig) => {
  return Object.assign({}, nextConfig, {
    webpack(config, options) {
      let enrichedConfig = config;

      const _oneOf = [];
      enrichedConfig.module.rules.forEach((rule) => {
        if (Array.isArray(rule)) {
          rule.forEach((loader) => {
            Array.isArray(loader.oneOf) && _oneOf.push(loader);
          });
        } else {
          Array.isArray(rule.oneOf) && _oneOf.push(rule);
        }
      });
      // console.log('---oneOf----\n');
      _oneOf.forEach((rule) => {
        rule.oneOf.forEach((_d) => {
          console.log(_d); // 打印出来的oneOf里和rule里都找不到less-loader
        });
      });

      return enrichedConfig;
    },
  });
};
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