fix(build): externalize @slack/web-api in build:cjs + declare as root dep#983
Conversation
… 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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR adds the Slack Web API client library ( ChangesSlack Web API Integration
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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
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. Comment |
What
scripts/build-cjs.mjs: add@slack/web-apito esbuildexternal(mirrorsssh2/better-sqlite3).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:cjsbundles the@agent-relay/slack-primitiveworkspace 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"brokebuild:cjsand 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:cjsnow passes (exit 0,dist/index.cjsproduced);@slack/web-apiis a runtimerequire()in the output, not inlined.🤖 Generated with Claude Code