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

How to get rid of file matching *.module.less? #28

Closed
sunhak-hout opened this issue Mar 14, 2021 · 2 comments
Closed

How to get rid of file matching *.module.less? #28

sunhak-hout opened this issue Mar 14, 2021 · 2 comments

Comments

@sunhak-hout
Copy link

I try this plugin and it works like a charm to me. Howerver, I'm facing one issue that I want to use style.less instead of style.module.less. I try some configuration with cssLoaderOptions as below, but seems nothing work for me. Any advice or solution on this?

// next.config.js
const withAntdLess = require("next-plugin-antd-less");

module.exports = withAntdLess({
  // optional
  lessVarsFilePath: "./src/styles/theme/variables.less",

  // optional https://github.com/webpack-contrib/css-loader#object
  cssLoaderOptions: {
    modules: {
      auto: (resourcePath) => resourcePath.endsWith(".less"),
    },
  },

  webpack(config) {
    return config;
  },
});
@SolidZORO
Copy link
Owner

I think you see the configuration here https://webpack.js.org/loaders/css-loader/#function-2

In this code snippet.

https://github.com/SolidZORO/next-plugin-antd-less/blob/master/index.js#L96-L115

You can see that the last line is auto: true and you can't override that with nextConfig.cssLoaderOptions.

Because this abc.less and abc.module.less naming convention is a best practice for css modules, and I'm not going to override auto.

So you can fork and change this configuration.


我想你是在这里看到配置的 https://webpack.js.org/loaders/css-loader/#function-2

在这个代码片段中:

https://github.com/SolidZORO/next-plugin-antd-less/blob/master/index.js#L96-L115

你可以看到,最后一行是 auto: true 而且你不能用 nextConfig.cssLoaderOptions 覆盖。

因为这 abc.lessabc.module.less 的命名方式是 css modules 的最佳实践,我不打算把 auto 覆盖掉。

所以你可以 fork 然后修改这个配置。

@sunhak-hout
Copy link
Author

@SolidZORO I didn't know the auto option is always set to true. Thanks for the reply. Really appreciate that :)

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

2 participants