Describe the bug
If set up terser with passes >=3
terserOptions: {
compress: {
passes: 3
}
}
The application does not load, you may see an error in the console:
Uncaught SyntaxError: identifier starts immediately after numeric literal
The cause of the problem is the minification of the code using a terser. It occurs if 3 or more passes are configured.
I thought this was a problem with the terser and tried for a long time to reproduce the error in REPL. But no matter what I do, everything works as expected and it happens only when the code is optimized through the Vite.
Reproduction
Reproduction repo: cawa-93/vite-terser-issue
- Clone reproduction repo:
git clone [email protected]:cawa-93/vite-terser-issue.git
cd ./vite-terser-issue
- Install deps:
npm ci
- Build and serve
npm run build && npm run sevce
- Open app http://localhost:5000
System Info
System:
OS: Windows 10 10.0.19042
CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
Memory: 9.36 GB / 15.42 GB
Binaries:
Node: 14.16.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
npm: 7.9.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.423.0), Chromium (90.0.818.41)
Internet Explorer: 11.0.19041.1
npmPackages:
@vitejs/plugin-vue: ^1.2.1 => 1.2.1
vite: ^2.2.0 => 2.2.0
Used package manager: npm
Before submitting the issue, please make sure you do the following
Describe the bug
If set up terser with
passes>=3The application does not load, you may see an error in the console:
The cause of the problem is the minification of the code using a terser. It occurs if 3 or more passes are configured.
I thought this was a problem with the terser and tried for a long time to reproduce the error in REPL. But no matter what I do, everything works as expected and it happens only when the code is optimized through the Vite.
Reproduction
Reproduction repo: cawa-93/vite-terser-issue
git clone [email protected]:cawa-93/vite-terser-issue.gitcd ./vite-terser-issuenpm cinpm run build && npm run sevceSystem Info
System: OS: Windows 10 10.0.19042 CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics Memory: 9.36 GB / 15.42 GB Binaries: Node: 14.16.1 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD npm: 7.9.0 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.19041.423.0), Chromium (90.0.818.41) Internet Explorer: 11.0.19041.1 npmPackages: @vitejs/plugin-vue: ^1.2.1 => 1.2.1 vite: ^2.2.0 => 2.2.0Used package manager: npm
Before submitting the issue, please make sure you do the following