Esbuild: format=iife and target=es5

Created on 19 Jul 2020  路  3Comments  路  Source: evanw/esbuild

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.

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.

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.

All 3 comments

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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aelbore picture aelbore  路  4Comments

lolychee picture lolychee  路  4Comments

sarsamurmu picture sarsamurmu  路  3Comments

qnp picture qnp  路  4Comments

fannheyward picture fannheyward  路  4Comments