Convert TypeScript package to ESM-only#261
Open
Arechii wants to merge 1 commit into
Open
Conversation
Switches the npm package from CommonJS to ESM-only output. - tsconfig.json: module/moduleResolution NodeNext, target ES2022 - package.json: adds "type": "module" and "exports" map; drops "main" - CI Generate: adds esModuleInterop=true and importSuffix=.js so ts-proto emits relative imports with .js extensions for NodeNext Breaking change for CommonJS consumers (require() is blocked by the exports map); a major version bump should accompany this before publishing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the @blueyerobotics/protocol-definitions npm package build output from CommonJS to ESM-only, aligning the TypeScript compiler and ts-proto generation with Node’s ESM/NodeNext requirements.
Changes:
- Update TypeScript compilation to
module/moduleResolution: NodeNextand raisetargettoES2022. - Convert the npm package to ESM-only via
"type": "module"and anexportsmap (dropping the previousmainentrypoint). - Adjust CI generation to emit
.js-suffixed relative imports and enableesModuleInteropin ts-proto output.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tsconfig.json | Switches TS compiler settings to NodeNext ESM output and ES2022 target. |
| package.json | Declares ESM-only package semantics and defines an exports map for the entrypoint/types. |
| .github/workflows/ci-typescript.yaml | Updates ts-proto generation options to be compatible with NodeNext ESM resolution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+10
to
+15
| "type": "module", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "import": "./dist/index.js" | ||
| } |
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "import": "./dist/index.js" |
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
@blueyerobotics/protocol-definitionsfrom CommonJS to ESM-only output.tsconfig.json:module/moduleResolutionset toNodeNext,targetraised toES2022.package.json: adds"type": "module"and anexportsmap (types+import); dropsmain.--ts_proto_opt=esModuleInterop=trueand--ts_proto_opt=importSuffix=.jsso ts-proto emits relative imports with.jsextensions, which NodeNext ESM requires.🤖 Generated with Claude Code