nitrojs / nitrojs/nitro

vite: nitro env build crashes with `getVariableForExportName` when @sentry/vite-plugin is present (regression after 2026-05-07 nightly)

Open
#4,471 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug tanstack v3
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

Environment
  • nitro: npm:nitro-nightly@3.0.1-20260722-224121-77b77ffb (vite integration, nitro/vite)
  • vite 7.3.6, rollup 4.62.2, Node 24, macOS (darwin-arm64)
  • @tanstack/react-start 1.168.32 (tanstackStart() plugin)
  • @sentry/tanstackstart-react 10.67.0 → @sentry/vite-plugin 5.4.0
Reproduction

https://github.com/ryanwoodcox/nitro-sentry-getvariable-repro

npm install && npm run build — the client and ssr environments build fine; the nitro environment crashes during Bundle.generate.

Describe the bug

Production builds crash in the nitro env whenever the Sentry vite plugin (sentryTanstackStart(), i.e. @sentry/vite-plugin) is in the plugin list, on every nightly newer than 2026-05-07:

✗ Build failed
Cannot read properties of null (reading 'getVariableForExportName')
    at getVariableForExportNameRecursive (rollup/dist/es/shared/node-entry.js:17211:19)
    at Module.getVariableForExportName
    at Module.getExportedVariablesByName
    at Module.getRenderedExports
    at Chunk.renderModules
    at Chunk.render
    at renderChunks
    at Bundle.generate
    at buildEnvironment (vite/dist/node/chunks/config.js)
    at buildEnvironments (nitro-nightly/dist/vite.mjs:123:17)

Isolation matrix (all vite 7.3.6 + react-start 1.168.32):

nitro sentryTanstackStart() result
nightly 2026-05-07 (3.0.1-20260507-123322-3a920552) yes ✓ builds
nightly 2026-07-22 (3.0.1-20260722-224121-77b77ffb) no ✓ builds
nightly 2026-07-22 yes ✗ crash

build.sourcemap on/off makes no difference. Bisected from a real app: nightlies 2026-05-19, 2026-06-10, 2026-07-07 (beta), 2026-07-22 all crash; 2026-05-07 is the last good nightly, so the regression landed in the 05-08 → 05-19 window.

Possibly related: in #4436 it was noted that flipping inlineDynamicImports: false on v3/main breaks the rollup build with this exact error — this report may be the same underlying issue reachable via a plugin that injects/references modules across chunks (the Sentry plugin emits debug-ID/release-injection modules into every chunk).

We are currently pinned to the 2026-05-07 nightly as a workaround.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the linked reproduction with npm install && npm run build, then inspect nitro/vite and the buildEnvironment/Bundle.generate path shown in the stack trace. Compare the 2026-05-07 and later nightlies, and review #4436; done means the nitro environment builds with @sentry/vite-plugin while the client and SSR builds remain working.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, rollup, typescript, vite
Domain
backend, build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.