You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Real world use case: https://github.com/microsoft/tslib/blob/main/tslib.js#L359
TS helper that gets injected in many many bundles, so when transpiling it with ESBuild this should remain intact, else it does not work in old JavaScript sandboxes such as the one that is used by Figma Plugins.
This issue is very specific to the "async" keyword, which isn't technically a reserved keyword in the same way that "await" is, because its meaning (async) can always be determined by its context to whether it's a variable or keyword. It's a bit "special" in that sense, and I'm guessing this is why in old JS engines it creates the error:
The text was updated successfully, but these errors were encountered:
this is why in old JS engines it creates the error
Please be specific. What specific JS engine (name and version)? If you're using an unusual JS engine that esbuild doesn't support, you can turn off support for this shorthand syntax with --supported:object-extensions=false.
I thought Figma plugins used QuickJS, but QuickJS appears to work fine. At least (function foo(async) { return {async} })(5) works fine on http://numcalc.com/ which is linked from https://bellard.org/quickjs/ as an online demo of QuickJS.
Please be specific. What specific JS engine (name and version)?
I'm not exactly sure, all I know is that it needs me to transpile to es6 and that it gives super cryptic errors when it's running something that it doesn't support 😓 I haven't been able to find more information on this sandboxed env that they use, so your guess is as good as mine. I'll try to ask around and see if they can point me to more specifics about what they're using.
Thanks for the tip on --supported:object-extensions=false, I'll try that!
The above pattern should not be transformed at all.
Actual behavior:
Reproduce (after creating a
foo.js
file locally):npx esbuild foo.js --outfile=_foo.js --target=es6
Real world use case: https://github.com/microsoft/tslib/blob/main/tslib.js#L359
TS helper that gets injected in many many bundles, so when transpiling it with ESBuild this should remain intact, else it does not work in old JavaScript sandboxes such as the one that is used by Figma Plugins.
This issue is very specific to the "async" keyword, which isn't technically a reserved keyword in the same way that "await" is, because its meaning (async) can always be determined by its context to whether it's a variable or keyword. It's a bit "special" in that sense, and I'm guessing this is why in old JS engines it creates the error:
The text was updated successfully, but these errors were encountered: