Skip to content

fix(compiler): correct module type for nodenext #639

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marcus-sa
Copy link
Contributor

Summary of changes

Updates getModuleType to correctly reflect how TypeScript determines the module type for NodeNext.

  1. If a file has .mjs or .cjs extension:

    • .mjs treat file as esm.

    • .cjs treat file as cjs.

  2. If a file has .ts or .js extension:

    • TypeScript checks the nearest package.json:
      • If "type": "module", treat file as esm.
      • If "type": "commonjs" or no type field, treat file as cjs.

Relinquishment of Rights

Please mark following checkbox to confirm that you relinquish all rights of your changes:

  • I waive and relinquish all rights regarding this changes (including code, text, and images) to Deepkit UG (limited), Germany. This changes (including code, text, and images) are under MIT license without name attribution, copyright notice, and permission notice requirement.

@marcus-sa marcus-sa force-pushed the fix/compiler-module-type-for-nodenext branch from e62bb53 to 89890d1 Compare March 26, 2025 09:32
@marcus-sa marcus-sa force-pushed the fix/compiler-module-type-for-nodenext branch from 89890d1 to 35ff3b9 Compare March 26, 2025 09:33
@marcus-sa
Copy link
Contributor Author

marcus-sa commented Mar 26, 2025

@marcj lockfile appears to be outdated

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

Successfully merging this pull request may close these issues.

1 participant