-
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
Unexpected token: punc ({) #59046
Comments
I can also confirm, facing the same issue! |
I believe my comment on another issue is related. When I set |
The error still occurs in version 14.0.1. |
I started working on this 😄 |
SWC transpiles static class properties to static blocks. export class TestClass {
static currentDate = new Date()
} output: class TestClass {
static{
this.currentDate = new Date();
}
} but it seems like terser is not recognizing it properly |
Wait... This means export class TestClass {
}
TestClass.currentDate = new Date(); this is the expected output |
Closing as fixed on canary. ![]() |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://github.com/lichbt-rk/next-14-minify-error
To Reproduce
Current vs. Expected behavior
Current: got the error
`> build
⚠ Disabling SWC Minifer will not be an option in the next major version. Please report any issues you may be experiencing to https://github.com/vercel/next.js/issues
✓ Linting and checking validity of types
▲ Next.js 14.0.4-canary.25
Failed to compile.
../pages/TestClass.js from Terser
Unexpected token: punc ({) [../pages/TestClass.js:174,10]
at js_error (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:32780)
at croak (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:43882)
at token_error (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:43989)
at unexpected (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:44055)
at as_property_name (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:68487)
at concise_method_or_getset (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:64746)
at class_ (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:64098)
at statement (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:46908)
at embed_tokens_wrapper (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:45013)
at block (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:56881)
../pages/index.js from Terser
Unexpected token: punc ({) [../pages/index.js:197,10]
at js_error (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:32780)
at croak (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:43882)
at token_error (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:43989)
at unexpected (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:44055)
at as_property_name (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:68487)
at concise_method_or_getset (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:64746)
at class_ (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:64098)
at statement (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:46908)
at embed_tokens_wrapper (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:45013)
at block (/home/lichbt/Projects/next-14-minify-error/node_modules/next/dist/compiled/terser/bundle.min.js:1:56881)
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
SWC transpilation
Additional context
No response
The text was updated successfully, but these errors were encountered: