You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A standalone content template app (single app, not a workspace) crashes on every request when deployed to Vercel or Netlify with NITRO_PRESET=vercel / NITRO_PRESET=netlify:
ReferenceError: Cannot access 'Ml' before initialization
at U (file:///var/task/_libs/@agent-native/core+[...].mjs:103:19158)
at file:///var/task/_libs/@agent-native/creative-context+[...].mjs:2:305
at ModuleJob.run (node:internal/modules/esm/module_job:343:25)
(The mangled variable name changes per build/minify pass — e.g. Ml, Zpe, Dl — but the call path is identical every time: @agent-native/creative-context's bundled chunk imports @agent-native/core's bundled chunk, which throws a temporal-dead-zone ReferenceError at top-level evaluation.)
This reproduces on both Vercel and Netlify, so it isn't platform-specific — it's the shared standalone build path both presets go through.
Repro
npx @agent-native/core@latest create my-app --standalone --template content
cd my-app
pnpm install
NITRO_PRESET=vercel pnpm build # or NITRO_PRESET=netlify# deploy the output (vercel deploy --prebuilt, or netlify deploy --build)# visit any route
Every route returns FUNCTION_INVOCATION_FAILED (Vercel) / "This function has crashed" (Netlify).
What I've ruled out
Not a version issue. Reproduces identically on @agent-native/core@0.133.3 (pinned) and @agent-native/core@0.146.1 (latest at time of testing) — same call path, only the minified variable name differs.
Not fixable by disabling minification. Patching build.ts's createNitro({ minify: true }) to false locally avoids the TDZ crash but trips a different guard: assertSingleTemplateNetlifyBuildOutput rejects the build with "Netlify server bundle leaves ingestion dependencies as runtime imports: officeparser" — so minification and the per-package chunk-splitting strategy are entangled, and turning one off breaks the other check.
Not a missing documented step. Followed the deployment docs exactly: NITRO_PRESET=vercel npx @agent-native/core@latest build (or the Vite plugin nitro.preset option) is the sanctioned build-time preset switch, and that's what was used.
Suspected root cause
build.ts's nitroNoExternalsForPreset() sets noExternals: [] for the netlify, vercel, and aws-lambda presets, causing Nitro's Rolldown pipeline to bundle every npm dependency into its own combined per-package chunk file (_libs/@agent-native/core+[...].mjs, _libs/@agent-native/creative-context+[...].mjs, etc.) instead of leaving them as regular node_modules imports. @agent-native/core and @agent-native/creative-context appear to have a circular import between them at the module level; when each package is isolated into its own chunk file, the evaluation order Rolldown picks for that split violates the TDZ for a const/let binding, crashing at cold start on every single route (not just ones touching creative-context features directly — even the app root crashes).
This same noExternals: [] treatment is shared by netlify/vercel/aws-lambda, which is consistent with the crash reproducing on both Vercel and Netlify but (presumably) not on the default node preset, which uses a much smaller externals allowlist (NITRO_SERVER_RUNTIME_BUNDLED_DEPS) instead of bundling everything.
Environment
@agent-native/core: reproduced on 0.133.3 and 0.146.1
Summary
A standalone
contenttemplate app (single app, not a workspace) crashes on every request when deployed to Vercel or Netlify withNITRO_PRESET=vercel/NITRO_PRESET=netlify:(The mangled variable name changes per build/minify pass — e.g.
Ml,Zpe,Dl— but the call path is identical every time:@agent-native/creative-context's bundled chunk imports@agent-native/core's bundled chunk, which throws a temporal-dead-zoneReferenceErrorat top-level evaluation.)This reproduces on both Vercel and Netlify, so it isn't platform-specific — it's the shared standalone build path both presets go through.
Repro
Every route returns
FUNCTION_INVOCATION_FAILED(Vercel) / "This function has crashed" (Netlify).What I've ruled out
@agent-native/core@0.133.3(pinned) and@agent-native/core@0.146.1(latest at time of testing) — same call path, only the minified variable name differs.patchVercelFunctionEntryinworkspace-deploy.ts) only applies to multi-appagent-native deploy --preset vercelworkspace deploys. A standalone app built viaagent-native build(which calls intobuild.ts, notworkspace-deploy.ts) never goes through that code path, so the fix is irrelevant here.build.ts'screateNitro({ minify: true })tofalselocally avoids the TDZ crash but trips a different guard:assertSingleTemplateNetlifyBuildOutputrejects the build with "Netlify server bundle leaves ingestion dependencies as runtime imports: officeparser" — so minification and the per-package chunk-splitting strategy are entangled, and turning one off breaks the other check.NITRO_PRESET=vercel npx @agent-native/core@latest build(or the Vite pluginnitro.presetoption) is the sanctioned build-time preset switch, and that's what was used.Suspected root cause
build.ts'snitroNoExternalsForPreset()setsnoExternals: []for thenetlify,vercel, andaws-lambdapresets, causing Nitro's Rolldown pipeline to bundle every npm dependency into its own combined per-package chunk file (_libs/@agent-native/core+[...].mjs,_libs/@agent-native/creative-context+[...].mjs, etc.) instead of leaving them as regularnode_modulesimports.@agent-native/coreand@agent-native/creative-contextappear to have a circular import between them at the module level; when each package is isolated into its own chunk file, the evaluation order Rolldown picks for that split violates the TDZ for aconst/letbinding, crashing at cold start on every single route (not just ones touching creative-context features directly — even the app root crashes).This same
noExternals: []treatment is shared bynetlify/vercel/aws-lambda, which is consistent with the crash reproducing on both Vercel and Netlify but (presumably) not on the defaultnodepreset, which uses a much smaller externals allowlist (NITRO_SERVER_RUNTIME_BUNDLED_DEPS) instead of bundling everything.Environment
@agent-native/core: reproduced on0.133.3and0.146.1nitro:3.0.260610-betacontent(standalone shape)vercel deploy --prebuilt), Netlify (Functions v2,netlify deploy --build)