You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bubble0601 opened this issue
Sep 9, 2024
· 1 comment
Labels
bugIssue was opened via the bug report template.RuntimeRelated to Node.js or Edge Runtime with Next.js.SWCRelated to minification/transpilation in Next.js.WebpackRelated to Webpack with Next.js.
Create a Next.js project using version 14.2.5 or newer.
Use an object with the middle dot character (・, U+30FB) as a key in your JavaScript code.
Build your project and serve it.
Access the site using an older version of iOS Safari (e.g., Safari 17.1).
Observe that you encounter a SyntaxError: Invalid character '\u30fb' and the script fails to load.
Current vs. Expected behavior
Current Behavior: In iOS Safari 17.1 and older, you encounter a SyntaxError due to the middle dot character not being properly quoted in the minified JavaScript output. This error occurs because the middle dot is now identified as a new identifier character in Unicode, which older browsers may not handle correctly.
Expected Behavior: Next.js is expected to support Safari 12 and newer. Therefore, the JavaScript output should correctly handle the middle dot character by quoting it, ensuring compatibility with Safari 12 and above.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:16:46 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8112
Available memory (MB): 24576
Available CPU cores: 8
Binaries:
Node: 20.16.0
npm: 10.8.1
Yarn: 1.22.22
pnpm: 7.29.3
Relevant Packages:
next: 14.2.5 // There is a newer version (14.2.8) available, upgrade recommended!
eslint-config-next: 13.4.9
react: 18.2.0
react-dom: 18.2.0
typescript: 5.1.6
Next.js Config:
output: export
Which area(s) are affected? (Select all that apply)
SWC, Webpack
Which stage(s) are affected? (Select all that apply)
Other (Deployed)
Additional context
The issue does not occur when swcMinify is set to false in next.config.js. However, this option will be removed in Next.js 15, so a more permanent solution is needed.
The problem is specific to older versions of iOS Safari and does not appear in latest versions.
The issue does not seem to occur in other browsers or environments.
This issue does not reproduce in local development environments, but only in the production build served on older iOS Safari versions.
The problem was not present in Next.js version 13.4.9 but occurs in version 14.2.5
The text was updated successfully, but these errors were encountered:
github-actionsbot
added
Runtime
Related to Node.js or Edge Runtime with Next.js.
SWC
Related to minification/transpilation in Next.js.
Webpack
Related to Webpack with Next.js.
labels
Sep 9, 2024
bugIssue was opened via the bug report template.RuntimeRelated to Node.js or Edge Runtime with Next.js.SWCRelated to minification/transpilation in Next.js.WebpackRelated to Webpack with Next.js.
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/tender-sun-8ygrks
To Reproduce
SyntaxError: Invalid character '\u30fb'
and the script fails to load.Current vs. Expected behavior
Current Behavior: In iOS Safari 17.1 and older, you encounter a SyntaxError due to the middle dot character not being properly quoted in the minified JavaScript output. This error occurs because the middle dot is now identified as a new identifier character in Unicode, which older browsers may not handle correctly.
Expected Behavior: Next.js is expected to support Safari 12 and newer. Therefore, the JavaScript output should correctly handle the middle dot character by quoting it, ensuring compatibility with Safari 12 and above.
Provide environment information
Which area(s) are affected? (Select all that apply)
SWC, Webpack
Which stage(s) are affected? (Select all that apply)
Other (Deployed)
Additional context
The text was updated successfully, but these errors were encountered: