OpenChat icon indicating copy to clipboard operation
OpenChat copied to clipboard

`.env.example` sets `NODE_ENV=development`, so local production builds return 500

Open ajanraj opened this issue 1 month ago • 0 comments

Problem

.env.example sets NODE_ENV="development" (line 6). With that line in .env, bun run build succeeds, but every page of the build returns 500.

Repro

With NODE_ENV="development" in .env, as in the template:

bun run build
bunx vite preview
curl -i http://localhost:4173/
HTTP 500
Error in renderToReadableStream: TypeError: (0 , import_jsx_dev_runtime.jsxDEV) is not a function
    at RootDocument (.output/server/_ssr/router-*.mjs)

Running both commands with NODE_ENV=production in the shell, which takes precedence over .env, returns 200.

Checked on main (17ade4e). Vercel builds don't read the local .env, so this affects local builds only, unless the variable was also copied into Vercel's environment settings (not checked).

Likely cause

Vite treats NODE_ENV=development in a .env file as a request for a development build, even under vite build (resolveConfig in Vite's node.js). JSX is then compiled with React's development runtime (jsxDEV). The Nitro server bundle loads React's production runtime, where jsxDEV is undefined.

Expected

A .env copied from .env.example gives working dev and production builds.

Possible fixes

  • Remove NODE_ENV from .env.example. Vite already sets it: development for vite dev, production for vite build. src/routes/api.composio.connect.ts:43 reads it and keeps working.
  • Existing .env files copied from the template need the line deleted too.

ajanraj avatar Oct 16 '26 21:10 ajanraj