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

import() in CommonJS creates a different copy module #589

Open
5 of 6 tasks
jochenschmich-aeberle opened this issue Jun 13, 2024 · 2 comments
Open
5 of 6 tasks

import() in CommonJS creates a different copy module #589

jochenschmich-aeberle opened this issue Jun 13, 2024 · 2 comments
Labels
bug Something isn't working pending triage

Comments

@jochenschmich-aeberle
Copy link

Acknowledgements

  • I read the documentation and searched existing issues to avoid duplicates
  • I am reporting a confirmed bug (not seek debugging help)
  • I understand this is a collaborative project and relies on my contributions
  • I read and understood the Contribution guide

Minimal reproduction URL

https://github.com/jochenschmich-aeberle/tsx-dynamic-import-error

Problem & expected behavior (under 200 words)

  • What happened: My reproduction example produces the expected output with Node 18, but not with Node 20. This happens since tsx version 4.12.0. The README.MD file contains a test case to confirm this.
  • What I expected: That all variant*.ts files would always log 2 - regardless of it's module type in the package.json or NodeJS / tsx version.
  • Error stack trace: None
  • Documentation links: https://github.com/jochenschmich-aeberle/tsx-dynamic-import-error/blob/main/README.md
  • Screenshots: None

Bugs are expected to be fixed by those affected by it

  • I'm interested in working on this issue

Compensating engineering work will speed up resolution and support the project

  • I'm willing to offer $10 for financial support
@jochenschmich-aeberle jochenschmich-aeberle added bug Something isn't working pending triage labels Jun 13, 2024
@privatenumber
Copy link
Owner

Duplicate of #499

BTW for the minimal reproduction, just the cjs directory suffices.

@jochenschmich-aeberle

This comment has been minimized.

@privatenumber privatenumber changed the title Dynamic imports in CJS modules cause severe mistakes in runtime behavior with Node 20 import() in CommonJS creates a different copy module Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending triage
Projects
None yet
Development

No branches or pull requests

2 participants