Repository navigation
fix: preserve ESM in the edge package export - #93
Merged
Merged
Conversation
yokelpole
marked this pull request as ready for review
October 15, 2026 18:17
bradens
approved these changes
Oct 15, 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.
Importing
@codex-data/sdk/edgein a browser retained GraphQL execution/schema validation and WebSocket server code. Its ESM entry used extensionless internal imports that resolved to CommonJS files. With normal browser resolution, the packed edge bundle measured 280,796 bytes minified.Build the edge ESM entry as one module, keeping package dependencies external so consumers can tree-shake their ESM exports. The same browser bundle now measures 48,376 bytes, an 83% reduction. This preserves the existing source import conventions.
Add regression tests against a packed SDK archive: enforce a 60 KiB browser budget, reject retained server/generated-operation code, and verify native ESM and CommonJS public imports.
pnpm testbuilds the package first; CI uses that command for both build/type checks and tests.Validation:
pnpm test --runInBand --coverage=false: all 80 tests passed, including socket integration tests and four packed-package checks.Bump the package version from
2.4.2to2.4.3.Adversarial consumer review: no actionable findings on the standards or spec axes. Additional checks:
.mts/.ctsconsumers under NodeNext and bundler resolution, withskipLibCheck: false.2.4.3.edge.mjsdiffers. CommonJS, declarations, and all other emitted files are byte-for-byte identical.9b713da.Native runtime checks covered Node 20 in CI and Node 24 locally; the declared minimum Node 17.5 was not executed directly.