Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting of __dirname breaks some ES modules #540

Open
lagnat opened this issue Jun 11, 2024 · 0 comments
Open

Setting of __dirname breaks some ES modules #540

lagnat opened this issue Jun 11, 2024 · 0 comments
Assignees

Comments

@lagnat
Copy link

lagnat commented Jun 11, 2024

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 with const. Still feels wrong to me but could be a good compromise.

@thdxr thdxr self-assigned this Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants