-
Notifications
You must be signed in to change notification settings - Fork 349
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
Use bigint literals instead of BigInt constructor. #928
Use bigint literals instead of BigInt constructor. #928
Comments
Just a guess: some older parsers cannot handle BigInt literals (e.g. Webpack 4's parser), but function calls work just fine :) |
That makes sense, though isn't that more the role of Babel to generate downlevel code for older runtimes? |
Hi @bhollis , @jcready , I did a quick test of using
So we could add a flag of like I had started a PR to just do the find/replace: But given it needs an option to avoid breaking pre-2020 runtimes, dunno, may not be worth it? |
Makes sense. I don't know how necessary it is, I'm just obsessed with bundle size. I can always write a Babel or Terser plugin to do the transformation. |
Cool; fwiw I'm going to close this out b/c I'm personally not going to work on it, but also if a PR showed up that built on #932 but moved the behavior behind a flag (or did |
Fixes #928. Since I finally got around to contributing, I figured I'd try this old issue out too, and it was surprisingly simple. Entirely up to you whether to trash it or not - it's not a very consequential option and the size optimization should probably be handled by terser/terser#1535 anyway, and it could cause some breakage for users. Supercedes #932.
🎉 This issue has been resolved in version 1.179.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Apologies if this has already been discussed, but looking at the output of ts-proto with
--ts_proto_opt=forceLong=bigint
, it usesBigInt("0")
instead of0n
, which would be smaller output.e.g.
vs.
The text was updated successfully, but these errors were encountered: