Skip to content

Conversation

@ericsciple
Copy link
Collaborator

@ericsciple ericsciple commented Dec 7, 2025

Summary

This PR documents the ESM migration plan and known issues discovered during implementation attempts.

The plan document (docs/esm-migration-plan.md) now includes:

  • Migration strategy using TypeScript 5.7+ rewriteRelativeImportExtensions
  • Known Issues and Workarounds discovered in December 2025
  • Required configuration changes
  • Implementation checklist

Also includes a workaround script (script/fix-dts-extensions.cjs) for a TypeScript bug.

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

Known Issues Discovered

1. TypeScript Version Conflicts in Monorepo

Root node_modules/typescript gets 4.9.5 from ts-node/tsutils. Fix: Add npm overrides.

2. ts-jest Incompatible with TypeScript 5.9+

ts-jest 29.4.6 uses JSDocParsingMode.ParseAll which breaks with TS ESM exports. Fix: Use ts-jest 29.0.3 and TypeScript 5.8.3.

3. TypeScript .d.ts Extension Bug

rewriteRelativeImportExtensions rewrites .ts.js in .js files but NOT in .d.ts files. Upstream: microsoft/TypeScript#61037 (unfixed). Workaround: Post-process script included.

4. languageserver Tests Hang

Tests pass on main but hang on ESM branch. Status: Needs investigation.

Test Results (December 2025 Attempt)

Package Tests Status
expressions 1068 ✅ Pass
workflow-parser 292 ✅ Pass
languageservice 452 ✅ Pass
languageserver 6 files ❌ Hangs

Status

  • Document migration plan
  • Document known issues and workarounds
  • Add workaround script for .d.ts bug
  • Fix languageserver test hang
  • Complete implementation

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.
@ericsciple ericsciple force-pushed the users/ericsciple/esm-migration-plan branch from d55352f to 10171d8 Compare December 11, 2025 02:51
@ericsciple ericsciple changed the title ESM Migration: Add file extensions to imports ESM Migration: Plan and known issues documentation Dec 11, 2025
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