ECMAScript icon indicating copy to clipboard operation
ECMAScript copied to clipboard

Configuring esbuild for bundling classes issue

Open joshbrew opened this issue 1 year ago • 0 comments

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.

joshbrew avatar Nov 08 '23 17:11 joshbrew