When I build the project for reproduction with Node v20.11.0, I get:
> Build error occurred
Error: Failed to collect page data for /
When I build the project with Node v20.12.2, I don't get any errors, but browsers throw Uncaught SyntaxError: Invalid or unexpected token when I access the app.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:23 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6020
Available memory (MB): 32768
Available CPU cores: 10
Binaries:
Node: 20.11.0
npm: 10.2.4
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 14.2.3 // Latest available version is detected (14.2.3).
eslint-config-next: N/A
react: 18.3.1
react-dom: 18.3.1
typescript: N/A
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
SWC
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
It seems that minification removes quotes unexpectedly.
swcMinify: false makes the build work properly.
Link to the code that reproduces this issue
https://github.com/mythosil/nextjs-issue-20240501/blob/master/pages/index.js
To Reproduce
npm install
npm run build
Current vs. Expected behavior
When I build the project for reproduction with Node v20.11.0, I get:
When I build the project with Node v20.12.2, I don't get any errors, but browsers throw
Uncaught SyntaxError: Invalid or unexpected token
when I access the app.Provide environment information
Which area(s) are affected? (Select all that apply)
SWC
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
It seems that minification removes quotes unexpectedly.
swcMinify: false
makes the build work properly.This problem happens when an object has a key with "・" (
U+30FB
KATAKANA MIDDLEDOT), like{ 'a・': '' }
. Similar issue here: https://github.com/evanw/esbuild/issues/1599