ESM migration: Add .js extensions for node16 moduleResolution#257
Merged
ericsciple merged 4 commits intomainfrom Dec 18, 2025
Merged
ESM migration: Add .js extensions for node16 moduleResolution#257ericsciple merged 4 commits intomainfrom
ericsciple merged 4 commits intomainfrom
Conversation
Migrate expressions, workflow-parser, and languageservice packages to use proper ESM imports with .js extensions that work with node16 moduleResolution. Changes: - Update tsconfig.build.json in each package to use module: node16 and moduleResolution: node16 - Add .js extensions to all relative import paths (Option B approach) - Fix yaml internal type imports in workflow-parser by defining local types - Add skipLibCheck to handle @types/node compatibility issues - Add TypeScript 5.8.3 override in root package.json - Add ESM migration plan documentation The languageserver package is deferred due to test hang issues that need further investigation. Fixes #154 - Upgrade moduleResolution from node to node16 or nodenext Fixes #110 - Published ESM code has imports without file extensions Fixes #64 - expressions: ERR_MODULE_NOT_FOUND attempting to run example Fixes #146 - Can not import @actions/workflow-parser Test results: - expressions: 1068 tests passed - workflow-parser: 292 tests passed - languageservice: 452 tests passed
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates three packages (expressions, workflow-parser, and languageservice) to proper ESM with node16 moduleResolution by adding .js extensions to all relative imports. This fixes critical issues where published ESM packages had extensionless imports that failed to load in Node.js 12+.
Key Changes:
- Updated
tsconfig.build.jsonin each package to usemodule: node16andmoduleResolution: node16 - Added
.jsextensions to all relative import statements in TypeScript source files - Upgraded TypeScript to 5.8.3 with override in root
package.json - Added comprehensive migration documentation
Reviewed changes
Copilot reviewed 185 out of 186 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
workflow-parser/tsconfig.build.json |
Added node16 module/moduleResolution config with skipLibCheck |
workflow-parser/src/**/*.ts |
Added .js extensions to ~100+ import statements across all source files |
workflow-parser/src/workflows/yaml-object-reader.ts |
Defined local types for yaml internals to avoid importing unexported types |
languageservice/tsconfig.build.json |
Added node16 module/moduleResolution config with skipLibCheck |
languageservice/src/**/*.ts |
Added .js extensions to ~150+ import statements across all source files |
expressions/tsconfig.build.json |
Added node16 module/moduleResolution config with skipLibCheck |
expressions/src/**/*.ts |
Added .js extensions to ~80+ import statements across all source files |
package.json |
Added TypeScript 5.8.3 as dev dependency with override configuration |
package-lock.json |
Updated TypeScript versions across workspace, maintaining 4.9.5 for languageserver |
docs/esm-migration-plan.md |
Added comprehensive 262-line migration plan documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Update languageserver blocker: vscode-languageserver v8.0.2 lacks ESM exports (not a test hang issue) - Document that Option B (manual .js extensions) was chosen over Option A due to ts-jest compatibility issues - Add workaround for yaml package internal types (LinePos, NodeBase) - Update migration status table with accurate reason for deferral - Add skipLibCheck note for @types/node compatibility
AllanGuigou
approved these changes
Dec 18, 2025
This was referenced Jan 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Users importing these packages in Node.js projects get
ERR_MODULE_NOT_FOUNDerrors because the published code is missing file extensions that Node.js requires. This PR adds the missing.jsextensions to fix the imports.Packages fixed:
@actions/expressions,@actions/workflow-parser,@actions/languageserviceDeferred:
@actions/languageserver(blocked by upstream dependency)Related Issues
moduleResolutionfromnodetonode16ornodenextin tsconfig #154@actions/workflow-parser#146Approach
Used Option B (manual
.jsextensions) from the migration plan, which:.jsextensions in source TypeScript filesnode16moduleResolutionrewriteRelativeImportExtensionsChanges
tsconfig.build.jsonin each package to usemodule: node16andmoduleResolution: node16.jsextensions to all relative import pathsskipLibCheck: trueto handle @types/node compatibility issuespackage.jsonTest Results
Deferred
The languageserver package is deferred from this migration due to test hang issues that need further investigation. See
docs/esm-migration-plan.mdfor details.Related