-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
module exports inside circular dependency #758
Comments
Thanks for the test case. It looks like the difference that makes TypeScript work is that TypeScript first sets |
Heads up that I'm probably going to have to break this due to how node has decided to implement I think I am ok with this breakage because esbuild is primarily a bundler, compatibility with node's ESM behavior is important, and this is a pretty narrow edge case. This circular import scenario should still work when the code is bundled, but it will no longer work when each file is converted from ESM to CommonJS independently. There is more discussion about the |
I found that when I build certain TypeScript sources using esbuild, I get an error caused by
module exports inside circular dependency
. This error does not occur when building with tsc.I discovered this when using TypeORM.
A sample of the code is presented here.
https://github.com/m-doi2/esbuild-circular-dependency-error-sample
In summary, it seems to be caused by the result of code conversion when exporting multiple times.
It is possible to work around this by modifying the way the TypeScript code is written, so I don't feel it is a serious problem at this point.
However, during some experiments, I confirmed some results that were somewhat redundant and disturbing compared to tsc, for example, the __exportStar method was generated even when star was not used, and the code to execute multiple __exportStar methods was generated.
I'm sorry I can't offer a complete solution, but I hope this report helps.
The text was updated successfully, but these errors were encountered: