Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

chore: mark heavy deps external in bundle-api so dynamic imports stay dynamic

nirholasc1e0e784fc98
diff --git a/scripts/bundle-api.mjs b/scripts/bundle-api.mjs
index 30f330e4d..9e45df1f3 100644
--- a/scripts/bundle-api.mjs
+++ b/scripts/bundle-api.mjs
@@ -36,6 +36,14 @@ async function collectRouteFiles(dir, out = []) {
return out;
}
+// Externals are NOT inlined into the bundle. esbuild leaves the import
+// statement intact and Vercel's NFT resolves it from node_modules. Mark heavy
+// or lazy-loaded deps as external so:
+// 1. The bundle stays small (faster Vercel function packaging).
+// 2. Dynamic imports stay dynamic at runtime instead of being inlined.
+// @sentry/node is the biggest offender — sentry.js uses `await import(...)`
+// to defer the ~15 MB OpenTelemetry instrumentation tree, but esbuild's
+// --bundle inlines dynamic imports unless the target is external.
const EXTERNALS = [
'sharp', 'canvas', 'fsevents',
'@ipshipyard/node-datachannel',
@@ -45,6 +53,12 @@ const EXTERNALS = [
'@metaplex-foundation/*',
'@bonfida/*',
'@pump-fun/*',
+ '@aws-sdk/*',
+ '@sentry/*',
+ '@opentelemetry/*',
+ '@asamuzakjp/*',
+ '@csstools/*',
+ 'jsdom',
'ethers',
];