Open subodh-malgonde opened 4 years ago
I think I figured out what the problem is. Antd uses .less
files but Nextjs' builtin CSS support does not support .less
files. So we need to use @zeit/next-less
.
However, if we use @zeit/next-less
, it disables the built in CSS support for .scss
files. This causes problems for me because I use .scss
files.
Is there a workaround to this?
Same problem here: https://github.com/lucasbastianik/next-with-antd-modularized-error
any update?
https://github.com/zeit/next-plugins/issues/598#issuecomment-618461761
I use this configure, it's working.
https://github.com/ye-will/next-plugin-antd
This plugin may help.
@gaozhitw @ye-will Thanks for sharing the solution, but it doesn't work for me: next@10.0.8
Seems like the solutions here are bit outdated. Is there a working solution for current versions of Next/Antd?
bump
Bug report
Describe the bug
I am using
antd
in my nextjs project. Importing the entire css bundle viaimport 'antd/dist/antd.css'
works, however I would like to have modular imports to reduce by page load speed.So I followed instruction from ant-design/babel-plugin-import to configure modular imports. However, I get an error when I try a modular import (in my case
Table
component of antd):To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
npm install
npm run dev
The error is triggered due to this line:
Expected behavior
There should be no error and the above modular import should work fine:
Screenshots
Not applicable
System information
OS: macOS
package.json
.babelrc
src/pages/ _app.js
src/styles.scss
src/pages/index.js
Additional context
I think it is related to this issue https://github.com/zeit/next.js/issues/9830