Skip to content
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

PlainTime.toString() throws error on Next.js production builds #36

Closed
cbodin opened this issue Apr 2, 2024 · 3 comments
Closed

PlainTime.toString() throws error on Next.js production builds #36

cbodin opened this issue Apr 2, 2024 · 3 comments

Comments

@cbodin
Copy link

cbodin commented Apr 2, 2024

Minimal reproducible example:
https://codesandbox.io/p/devbox/temporal-polyfill-nextjs-bug-7n38kr?file=%2Fapp%2Fpage.tsx

Running npm run dev works as expected, npm run build-start will throw an error when clicking the button.

@arshaw
Copy link
Member

arshaw commented Apr 3, 2024

Thanks for the report @cbodin. After some frustrating debugging, I've found this is a minification bug in Next's SWC.

If you set swcMinify: false in your next.config.js, you'll see the problem goes away.

I need to further reduce where the problem is happening. In temporal-polyfill's sourcecode, somewhere near the array spread in formatPlainTimeIso.

@arshaw
Copy link
Member

arshaw commented Apr 3, 2024

^^See above issue in swc

@arshaw
Copy link
Member

arshaw commented Apr 6, 2024

Very soon after I reported this bug to SWC, they fixed it.

Also, I created an easy workaround for older versions of SWC/Next.js and released it in v0.2.4

@arshaw arshaw closed this as completed Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants