Skip to content

Conversation

@ericsciple
Copy link
Collaborator

Summary

This PR adds a migration plan for fixing ESM module resolution issues. No code changes yet - just the plan document.

Issues This Will Fix

Closes #154 - Upgrade moduleResolution from node to node16 or nodenext in tsconfig
Closes #110 - Published ESM code has imports without file extensions
Closes #64 - expressions: ERR_MODULE_NOT_FOUND attempting to run example demo script
Closes #146 - Can not import @actions/workflow-parser

Problem

The published ESM packages have extensionless imports like:

export { Expr } from "./ast";  // Missing .js extension!

This is invalid ESM and causes ERR_MODULE_NOT_FOUND errors when users try to import the packages in:

  • Node.js ESM mode
  • Vite
  • Deno
  • Other modern ESM environments

Proposed Solution

See docs/esm-migration-plan.md for the full plan.

TL;DR:

  1. Upgrade TypeScript to 5.7+
  2. Switch to moduleResolution: "node16"
  3. Enable rewriteRelativeImportExtensions: true
  4. Add .ts extensions to all relative imports
  5. Update JSON imports to use import attributes

Status

  • Wait for pending PRs to merge (to avoid conflicts)
  • Review and approve plan
  • Implement migration

Related PRs

Add detailed plan for migrating to moduleResolution node16/nodenext with
file extensions in imports.

This plan addresses:
- #154 - Upgrade moduleResolution from node to node16/nodenext
- #110 - Published ESM code has imports without file extensions
- #64 - expressions: ERR_MODULE_NOT_FOUND attempting to run example demo script
- #146 - Can not import @actions/workflow-parser

The migration will:
1. Upgrade TypeScript to 5.7+
2. Enable rewriteRelativeImportExtensions
3. Add .ts extensions to all relative imports
4. Update JSON imports to use import attributes

Implementation will begin after pending PRs are merged to avoid conflicts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants