-
Notifications
You must be signed in to change notification settings - Fork 27.6k
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
SyntaxError for @import when building with NextJS 9, not during development #8150
Comments
We are having the same exact issue. I tried following other posts as well as the official Next/Antd example to no avail. Everything was working just perfectly in v8 but just build breaking in v9. One can only stare at babelrc, next config, and webpack for so long before losing their mind, ha! Wish I could be of more help. Will definitely post back if I figure out a non-hacky solution. |
Also, We having the same exact issue. !!!!! any solution with Nextjs 9.0.2? |
I actually got it working by adding the But this is still only a workaround and not a fix, since it's working without it in next 8. |
Having the same issue. |
@Kombustor @taylorhayduk @Andy671 @toolmantim I end up to use
and now it working .
|
I've noticed I only get this error when setting the babel import plugin for antd's style to 'true'.
I've also put in the "isServer" script in in next.config.js as per the next/antd example and played whack-a-mole with other bugs with the Next9 Upgrade. It all seems to come down this style being true. |
You'll need to use the webpack config here if you're using less by setting the babel import antd style to true (see by babelrc above). https://github.com/zeit/next.js/blob/master/examples/with-ant-design-less/next.config.js If you aren't using less, I think you should be able to use If you ARE using less (i.e. setting style to true in babel), try the following:
|
I was able to get NextJS 9 / Antd with custom theming working in both development and production with this example here: https://github.com/zeit/next.js/tree/canary/examples/with-ant-design-less |
@taylorhayduk if I have two UI framework ant-design(.less) and hiynn-design(.scss),how to setting next.config.js
the up is my next.config.js,when I run 'yarn build' is error |
anybody can help me? |
Closing in favor of #9830 |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
SyntaxError for less @import statement during bundling.
Describe the bug
When using
next
in development, everything just works fine. The theme under ./assets/antd-theme.less is applied and can be changed, the antd-components render just fine.Using
next build
for production usage throws the error above.To Reproduce
Demo repository here: https://github.com/Kombustor/next-import-bug-demo
npm install
next
=> working finenext build
=> ErrorExpected behavior
To create the production build without throwing an error.
System information
Additional context
I know it's the same issue as in #7957 and #8054 but it was working perfectly fine like this in NextJS 8 (check out the next8 branch), without any hacky CSS webpack configuration etc. Please check the repository and how simple it's configured compared to the solutions mentioned in these issues before closing mine.
The text was updated successfully, but these errors were encountered: