Geequlim / ECMAScript

Javascript binding for godotengine
MIT License
959 stars 84 forks source link

Configuring esbuild for bundling classes issue #178

Open joshbrew opened 10 months ago

joshbrew commented 10 months ago

I've been piecing together how to use this API from the main guide (the older examples won't load the jsx files) and I am having an issue bundling through esbuild which was used in some of the examples, albeit an older version. For whatever reason, esbuild recompiles the class syntax and then the ECMAscript interpreter can't recognize it. If I just reformat back then it works again, but this rules out bundling in my current config:

Before bundling:

281287424-833c3c45-7f1a-419d-b236-0447e1531b8f

After bundling:

281287335-a05b0f0f-c205-4f65-a3b1-69635cc984f5

So the top works, the bottom doesn't. What esbuild versions are you using or are there some special settings to use to prevent this? Otherwise it's just an esm compilation.

In the examples, the esbuild compilation still preseves the class x syntax instead of this odd var x = class { which anonymizes the class itself. This seems to be innate to esbuild.