Skip to content

Commit c6c904b

Browse files
khaliqgantProactive Runtime Botclaude
authored
fix(build): externalize @slack/web-api in build:cjs + declare as root dep (#983)
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: Proactive Runtime Bot <agent@agent-relay.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ec38236 commit c6c904b

3 files changed

Lines changed: 39 additions & 32 deletions

File tree

package-lock.json

Lines changed: 32 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
"@relaycast/sdk": "^1.1.0",
146146
"@relayfile/local-mount": "^0.2.2",
147147
"@relayfile/sdk": "^0.6.0",
148+
"@slack/web-api": "^7.16.0",
148149
"agent-trajectories": "^0.5.8",
149150
"commander": "^12.1.0",
150151
"dotenv": "^17.2.3",

scripts/build-cjs.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ await build({
1414
bundle: true,
1515
target: 'node18',
1616
logLevel: 'info',
17-
// Exclude native dependencies from bundle - they're loaded dynamically at runtime
18-
external: ['better-sqlite3', 'ssh2'],
17+
// Exclude native dependencies from bundle - they're loaded dynamically at runtime.
18+
// @slack/web-api lives in the @agent-relay/slack-primitive workspace (whose
19+
// source is bundled here); keep it external + declared as a runtime dep so the
20+
// CJS build doesn't have to resolve/bundle the Slack SDK (it isn't installed in
21+
// every publish context) and consumers load it from node_modules at runtime.
22+
external: ['better-sqlite3', 'ssh2', '@slack/web-api'],
1923
banner: {
2024
js: "const import_meta_url = require('node:url').pathToFileURL(__filename).href;",
2125
},

0 commit comments

Comments
 (0)