Open steelbrain opened 1 month ago
This is unexpected behavior but unrelated to tsx. You can run it in Node and get the same behavior. I hope to fix it via tsx in the future though.
Modules can parse named exports from CommonJS via cjs-module-lexer, but that's unable to parse UMD format.
Thank you for the pointers @privatenumber. Much appreciated!
I hope to fix it via tsx in the future though.
That would be really helpful. I ran into this while trying to run some code that worked fine in Next.js but broke in tsx
. Handling it here would make it easier for people to run tsx on existing codebases.
Acknowledgements
Minimal reproduction URL
https://github.com/steelbrain/2024-09-tsx-bug-repro
Problem & expected behavior (under 200 words)
Hey Team! Really confused by the output of
tsx
changing based onpackage.json#type
instead oftsconfig.json
. Please have a look at the repro repository. It's possible that this isn't a bug in tsx and is a behavior coming in from esbuild.Either way, would love to hear based on your experience why this is happening and any pointers on how we could mitigate the impact. I burned through some solid time trying to isolate the bug that led me here. Happy to do a PR (if someone can walk me through it) or financially sponsor a fix here.
Bugs are expected to be fixed by those affected by it
Compensating engineering work will speed up resolution and support the project