[v8] fix: bundle ESM-only deps for CJS compatibility#1423
Merged
Conversation
iron-webcrypto and uint8array-extras are ESM-only packages. Without bundling, CJS consumers get ERR_REQUIRE_ESM errors and need special Jest/bundler configuration.
Contributor
Greptile SummaryThis PR adds Changes:
Context: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant CJS as CJS Consumer
participant PKG as @workos-inc/node (CJS)
participant IRON as iron-webcrypto (bundled)
participant U8A as uint8array-extras (bundled)
Note over CJS,U8A: Build Process (tsdown)
Note over PKG: unbundle: true<br/>(deps stay external by default)
Note over IRON,U8A: noExternal: ['iron-webcrypto', 'uint8array-extras']<br/>(bundle these ESM-only deps)
Note over CJS,U8A: Runtime Usage
CJS->>PKG: require('@workos-inc/node')
Note over PKG: CJS build (lib/index.cjs)
PKG->>IRON: uses bundled iron-webcrypto
Note over IRON: No ERR_REQUIRE_ESM!<br/>(bundled as CJS)
IRON->>U8A: uses bundled uint8array-extras
Note over U8A: No ERR_REQUIRE_ESM!<br/>(bundled as CJS)
U8A-->>IRON: returns
IRON-->>PKG: seal/unseal functions
PKG-->>CJS: WorkOS SDK methods
|
stanleyphu
approved these changes
Dec 22, 2025
nicknisi
added a commit
that referenced
this pull request
Jan 8, 2026
Bundle `iron-webcrypto` and `uint8array-extras` into the build output using `noExternal`. These packages are ESM-only and cause `ERR_REQUIRE_ESM` errors for CJS consumers without special Jest/bundler configuration.
nicknisi
added a commit
that referenced
this pull request
Jan 9, 2026
Bundle `iron-webcrypto` and `uint8array-extras` into the build output using `noExternal`. These packages are ESM-only and cause `ERR_REQUIRE_ESM` errors for CJS consumers without special Jest/bundler configuration.
nicknisi
added a commit
that referenced
this pull request
Jan 12, 2026
Bundle `iron-webcrypto` and `uint8array-extras` into the build output using `noExternal`. These packages are ESM-only and cause `ERR_REQUIRE_ESM` errors for CJS consumers without special Jest/bundler configuration.
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.
Bundle
iron-webcryptoanduint8array-extrasinto the build output usingnoExternal.These packages are ESM-only and cause
ERR_REQUIRE_ESMerrors for CJS consumers without special Jest/bundler configuration.