The product of the build has changed in structure from the third party's original file, specifically, the template string of the third party's original file has been converted incorrectly, resulting in a JSON parse error.
The third party original code:
(It's too long. I've cut off part of it.
I run the code, works
next The compiled product, the template string is converted to a normal string, and throw an error.
And copy the JSON.parse part code and run in console. Error.
And in the actual run, the reported error is the same
I was expecting that. next.js should not be converting template strings. Not only is the conversion incorrect here, but it also doesn't respect browserlist, even though I've set the browserlist target to the last 1 chrome version.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.0.0: Mon Aug 12 20:52:12 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T6020
Available memory (MB): 32768
Available CPU cores: 12
Binaries:
Node: 22.3.0
npm: 10.2.4
Yarn: 1.22.21
pnpm: 9.11.0
Relevant Packages:
next: 14.2.13 // Latest available version is detected (14.2.13).
eslint-config-next: N/A
react: 18.3.1
react-dom: 18.3.1
typescript: 5.6.2
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)
hmm isn't this a duplicate of https://github.com/vercel/next.js/issues/70500 (your linked issue)? Also it's fixed on Next.js 15 canary so I expect they will be porting the update to Next.js 14 soon or later
Link to the code that reproduces this issue
https://github.com/Innei/next-bundle-regexp-repro
To Reproduce
Current vs. Expected behavior
The product of the build has changed in structure from the third party's original file, specifically, the template string of the third party's original file has been converted incorrectly, resulting in a JSON parse error.
(It's too long. I've cut off part of it.
I run the code, works
And copy the JSON.parse part code and run in console. Error.
And in the actual run, the reported error is the same
I was expecting that. next.js should not be converting template strings. Not only is the conversion incorrect here, but it also doesn't respect browserlist, even though I've set the browserlist target to the last 1 chrome version.
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
No response