Closed OverLord561 closed 5 months ago
Please search first: https://github.com/privatenumber/esbuild-loader/issues/349
Thank you very much!
Going to post the issue here https://github.com/evanw/esbuild.
But isn't Cloudflare the one with the bug in their JS engine?
Problem with minification
Hi! I have a code like this and the problem is with (0.0) minimization
(0.0).toLocaleString('en-US', { style: 'currency', currency: 'USD' }).replace('0.00', '');
it will be minified to0 .toLocaleString('en-US', { style: 'currency', currency: 'USD' }).replace('0.00', '');
There is the whitespace after 0 before .toLocaleString
Later Cf-Bgj: minify feature of Cloudflare will remove whitespace before toLocaleString
0.toLocaleString('en-US', { style: 'currency', currency: 'USD' }).replace('0.00', '');
which cause Uncaught SyntaxError: Invalid or unexpected token
Expected behavior
Default behaviour like in Terser when number is wrapped into brackets
(0).toLocaleString('en-US', { style: 'currency', currency: 'USD' }).replace('0.00', '');
Minimal reproduction URL
https://stackblitz.com/edit/vitejs-vite-tha46h?file=currency.js
Version
Chrome Version 124.0.6367.119 (Official Build) (64-bit)
Node.js version
20.11
Package manager
pnpm
Operating system
Linux
Contributions