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
Module parse failed: Unexpected token error when using next/link in storybook #38106
Comments
It seems that Webpack still doesn't provide support for the class field proposal. @sokra @alexander-akait Class Field proposal is stage 4 already and is already landed in ES2022. It is about time to implement it in Webpack. |
## Bug - [x] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` Fixes #38106. Currently, the `shared/lib` directory (**which will also be shipped to legacy browsers**) is precompiled under `swcServerOptions`, which targets Node.js 12 and is way too modern: - The public class field syntax is only supported since Chrome 72, Firefox 69, Edge 79, and Safari 14.1. - Webpack currently doesn't support the public class field syntax as well (which causes the issue #38106) - `async/await` syntax is also supported in Node.js 12 but not in the legacy browsers. The PR fixes the issue by pre-compiling the `shared/lib` directory using `swcClientOptions` (which targets the ES5). Note: - The only way to validate the fix is to run an integration test case on a legacy browser. - The output size is increased by a little. But the size impact can be minimized by enabling `@swc/helpers` (which I will bring up in the next PR)
Fixed in "next": "12.2.1-canary.1" - npm i next@canary |
- Next.js 12.2.0 업데이트 후 next/link에서 error 발생 (vercel/next.js#38106) - storybook이 실행이 안된 문제를 next@v12.2.1-canary.2로 업데이트
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
Describe the Bug
Expected Behavior
Run storybook without errors
Link to reproduction
https://github.com/jeremytenjo/starter-website
To Reproduce
npm run storybook:dev
The text was updated successfully, but these errors were encountered: