-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
Unable to configure modular imports for antd with babel-import-plugin #11403
Comments
I think I figured out what the problem is. Antd uses However, if we use Is there a workaround to this? |
Same problem here: https://github.com/lucasbastianik/next-with-antd-modularized-error |
any update? |
#11837 check the babelrc file and it should fix modular imports problem |
vercel/next-plugins#598 (comment) 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: |
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 #9830
The text was updated successfully, but these errors were encountered: