As discussed in Discord, this is being added to the esbuild in order to workaround modules that are expecting __dirname to be defined. It's my understanding that ion bundles code targeting ESNext and as such __dirname will not be set by nodejs. Any ES module that then tries to define __dirname will fail in ion.
I believe the approach should be that __dirname is never set by ion, unless opted-in, and even that feels out of scope for ion.
Another approach is that ion doesn't set __dirname with const. Still feels wrong to me but could be a good compromise.
Possibly some wrong assumptions lie ahead..
As discussed in Discord, this is being added to the esbuild in order to workaround modules that are expecting
__dirname
to be defined. It's my understanding that ion bundles code targeting ESNext and as such__dirname
will not be set by nodejs. Any ES module that then tries to define__dirname
will fail in ion.I believe the approach should be that
__dirname
is never set by ion, unless opted-in, and even that feels out of scope for ion.Another approach is that ion doesn't set
__dirname
withconst
. Still feels wrong to me but could be a good compromise.