When I use this arguments combination --format=iife --target=es5
the resulting file contains (() => {})()
instead of good ol' (function() {})()
. I suppose that is an issue since arrow functions were introduced in ES6 and not ES5.
ES5 isn鈥檛 a valid target: https://github.com/evanw/esbuild#javascript-syntax-support
This is actually already fixed on master. I realized this late last night and fixed it but I haven't done a new release yet. The fix should be out sometime today.
ES5 isn鈥檛 a valid target: https://github.com/evanw/esbuild#javascript-syntax-support
It is actually. I added it recently so you can tell esbuild to not introduce ES6 syntax even though there isn't any in the input. For example, without this flag esbuild will replace string literals containing newlines with template literals because they are shorter.
@evanw probably worth updating the README too, then, as it still says ES6 is as low as it will go. Although from what you said, it doesn't sound like a transpile target (in the traditional Babel sense), more a "hands-off" flag?
Most helpful comment
This is actually already fixed on master. I realized this late last night and fixed it but I haven't done a new release yet. The fix should be out sometime today.
It is actually. I added it recently so you can tell esbuild to not introduce ES6 syntax even though there isn't any in the input. For example, without this flag esbuild will replace string literals containing newlines with template literals because they are shorter.