SolidZORO / next-plugin-antd-less

🎩 Use Antd (Less) with Next.js v12, Zero Dependency on other Next-Plugins.
MIT License
345 stars 48 forks source link

Importing css or scss file no longer possible #1

Closed richmonkeys closed 3 years ago

richmonkeys commented 3 years ago

Error CSS Modules cannot be imported from within node_modules. when trying to import css or scss file directly in jsx components.

import styles from './DefaultLayout.module.scss'

The code causing this: https://github.com/SolidZORO/next-plugin-antd-less/blob/4991a3ed4324c0bafb721bd50b45d33c0c631b71/index.js#L93

I think we are supposed to insert the lessModule instead of replacing sassModule with it, in order to existing sass loader and it's features.

Proposed fixed:

rules[1].oneOf.splice(sassModuleIndex, 0, lessModule);
digz6666 commented 3 years ago

Can I import less in component like this?