Skip to content

fix(build): externalize @slack/web-api in build:cjs + declare as root dep#983

Merged
khaliqgant merged 1 commit into
mainfrom
fix/build-cjs-external-slack-web-api
May 25, 2026
Merged

fix(build): externalize @slack/web-api in build:cjs + declare as root dep#983
khaliqgant merged 1 commit into
mainfrom
fix/build-cjs-external-slack-web-api

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

What

  • scripts/build-cjs.mjs: add @slack/web-api to esbuild external (mirrors ssh2/better-sqlite3).
  • root package.json: declare @slack/web-api: ^7.16.0 (matches @agent-relay/slack-primitive); lockfile hoists it to root (7.15.2→7.16.0).

Why

build:cjs bundles the @agent-relay/slack-primitive workspace source, which imports @slack/web-api. esbuild had to resolve+bundle it, but it isn't installed in every publish context → Could not resolve "@slack/web-api" broke build:cjs and the agent-relay publish. Externalizing it (loaded at runtime) + declaring it as a root dep fixes the build deterministically and keeps it resolvable at runtime for consumers.

Verified

npm run build:cjs now passes (exit 0, dist/index.cjs produced); @slack/web-api is a runtime require() in the output, not inlined.

🤖 Generated with Claude Code

… dep

build:cjs bundles the @agent-relay/slack-primitive workspace source, which
imports @slack/web-api. esbuild had to resolve+bundle it, but it isn't installed
in every publish context -> 'Could not resolve @slack/web-api' broke build:cjs
(and the agent-relay publish). Mirror the ssh2/better-sqlite3 pattern:
externalize @slack/web-api (loaded at runtime) AND declare it as a root
agent-relay dependency (^7.16.0, matching slack-primitive) so consumers resolve
it from node_modules. Hoists it to root in the lockfile (7.15.2 -> 7.16.0).

build:cjs now passes; @slack/web-api is a runtime require() in dist/index.cjs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@khaliqgant khaliqgant requested a review from willwashburn as a code owner May 25, 2026 06:29
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5761bbf7-cb4c-4991-aa30-9f0c6ab8fd0d

📥 Commits

Reviewing files that changed from the base of the PR and between ec38236 and 0b8aac6.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • package.json
  • scripts/build-cjs.mjs

📝 Walkthrough

Walkthrough

The PR adds the Slack Web API client library (@slack/web-api@^7.16.0) as a project dependency and configures the CJS build to externalize it so it is resolved at runtime rather than bundled.

Changes

Slack Web API Integration

Layer / File(s) Summary
Slack Web API dependency and build externalization
package.json, scripts/build-cjs.mjs
@slack/web-api is declared in dependencies and marked as external in the esbuild CJS configuration to ensure it is installed separately and not bundled into the distribution.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • AgentWorkforce/relay#956: Both PRs involve updating @slack/web-api to ^7.16.0 in package.json; this PR adds it as a new dependency and externalizes it in the CJS build, while the related PR addresses a security advisory through the same dependency version bump.

Suggested reviewers

  • willwashburn

Poem

🐰 A Slack connection now appears,
External, never bundled here!
The runtime calls, the API gleams,
Your messages flow through relay's streams! 📨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: externalizing @slack/web-api in the CJS build and declaring it as a root dependency.
Description check ✅ Passed The description covers the What, Why, and Verified sections with good detail, though it lacks the template's Test Plan and Screenshots sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/build-cjs-external-slack-web-api

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: one or more packages not found in the registry.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

@khaliqgant khaliqgant merged commit c6c904b into main May 25, 2026
41 checks passed
@khaliqgant khaliqgant deleted the fix/build-cjs-external-slack-web-api branch May 25, 2026 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant