Skip to content

Commit 9756d1c

Browse files
vtempestclaude
andcommitted
fix: alias grab-url to fetch-based implementation for Cloudflare Workers
Changed vite.config.ts to alias 'grab-url' imports to lib/api/grab.ts, which uses native fetch API instead of Node.js HTTP client. This fixes Cloudflare Workers deployment error where grab-url module couldn't be resolved in the Worker bundle. Also removed grab-url from external lists since it's now aliased to our bundled fetch implementation. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 4b13504 commit 9756d1c

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

apps/qwksearch-web/vite.config.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,23 @@ export default defineConfig(({ command }) => ({
2929
"extract-pdf": resolve(__dirname, "../../packages/extract-pdf/src"),
3030
"extract-youtube": resolve(__dirname, "../../packages/extract-youtube/src"),
3131
"qwksearch-api-client": resolve(__dirname, "../../packages/qwksearch-api-client/src"),
32-
"grab-url": resolve(__dirname, "../../node_modules/grab-url"),
32+
"grab-url": resolve(__dirname, "./lib/api/grab.ts"),
3333
},
3434
},
3535
build: {
3636
rollupOptions: {
3737
// `fsevents` is an optional macOS-only native module that rollup/chokidar
3838
// require() lazily inside a try/catch; it has no place in the Worker
3939
// bundle and is never installed on Linux, so leave it external.
40-
// `grab-url` is a Node.js HTTP client that shouldn't be bundled in client code.
4140
// `@mastra/core` and `@mastra/mcp` are optional dependencies with incorrect package.json exports.
4241
// `@composio/core` is only used in optional integration files.
43-
external: ["fsevents", "grab-url", "@mastra/core", "@mastra/mcp", "@composio/core"],
42+
external: ["fsevents", "@mastra/core", "@mastra/mcp", "@composio/core"],
4443
},
4544
rolldownOptions: {
4645
// Rolldown (Vite 8.x bundler) needs its own external list.
4746
// AI SDK packages are server-only and must not be bundled into client code.
4847
external: [
4948
"fsevents",
50-
"grab-url",
5149
"@mastra/core",
5250
"@mastra/mcp",
5351
"@composio/core",

0 commit comments

Comments
 (0)