Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minifying JavaScript with Unicode identifiers next to keywords produces syntax error #2910

Closed
satgo1546 opened this issue Feb 12, 2023 · 1 comment

Comments

@satgo1546
Copy link

$ esbuild --version
0.17.7
$ cat index.js
a.π in a
$ esbuild index.js --minify --charset=utf8
a.πin a;
$ node -e 'a.πin a;'
[eval]:1
a.πin a;
      ^

SyntaxError: Unexpected identifier 'a'
    at ...

The same goes for other keywords such as of and instanceof.

Meanwhile, the problem is mitigated by --charset=ascii.

$ esbuild index.js --minify
a.\u03C0 in a;
@evanw
Copy link
Owner

evanw commented Feb 12, 2023

Thanks for the report. Looks like esbuild is only looking at the previous byte for this, which is incorrect for Unicode. I’ll fix this in the next release.

@evanw evanw closed this as completed in 1db6e12 Feb 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants