fix: correct @agent-relay/utils CJS exports for CommonJS compatibility#328
Merged
khaliqgant merged 1 commit intomainfrom Jan 28, 2026
Merged
fix: correct @agent-relay/utils CJS exports for CommonJS compatibility#328khaliqgant merged 1 commit intomainfrom
khaliqgant merged 1 commit intomainfrom
Conversation
The @agent-relay/utils package had "main" and "default" export fields pointing to the ES module (dist/index.js) instead of the CommonJS version (dist/cjs/index.js). This caused require() calls to fail with "ERROR: require() of ES Module ... not supported" when used from CommonJS contexts like the Docker verification tests. Changes: - Set "main" field to "dist/cjs/index.js" (was "dist/index.js") - Reorder exports conditions: require before import - Set "default" field to "./dist/cjs/index.js" for all export paths This matches the fix applied to the root package in PR #325 and resolves the Docker 18 spawn infrastructure test failure. 🤖 Generated with Claude Code Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
khaliqgant
added a commit
that referenced
this pull request
Jan 28, 2026
packages Add bundledDependencies array to force npm to include all @agent-relay/* packages in the tarball instead of fetching them from npm registry. This ensures that when Docker installs the package, it uses the fixed CJS exports from the bundled versions rather than old registry versions. This fixes the Docker 18 spawn infrastructure test by ensuring: 1. npm install uses bundled packages from tarball (not registry) 2. All @agent-relay packages include the CJS export fixes 3. require('@agent-relay/utils') works correctly in Docker tests Bundled packages: - All 17 @agent-relay/* dependencies - Ensures consistent versions across all environments - Tradeoff: Larger tarball (~50MB) but guarantees registry independence Follow-up to: - PR #328: CJS export fixes for @agent-relay/utils - Merged commit 1a0cf6e 🤖 Generated with Claude Code Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
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
Root Cause: The Docker 18 spawn infrastructure test fails because
require('@agent-relay/utils')receives the ES module instead of the CommonJS version.Issue:
@agent-relay/utils/package.jsonhad:"main": "dist/index.js"(ES module)"default": "./dist/index.js"in exports (ES module)When CommonJS code tries to
require()the package, Node.js gets the ES module path, causing:Solution
Updated
@agent-relay/utils/package.json:"main"fromdist/index.js→dist/cjs/index.jsrequirebeforeimport"default"fields to point todist/cjs/*versionsThis matches the fix from PR #325 applied to the root package and ensures CommonJS compatibility.
Testing
require('agent-relay')Files Changed
packages/utils/package.json: Updated main and exports fields for CJS compatibility🤖 Generated with Claude Code
Co-Authored-By: Claude Haiku 4.5 noreply@anthropic.com