TypeError: __exportAll is not a function — the deploy that only breaks after you merge
published: false tags: vercel, nitro, tanstack, debugging Production went down twice in one day with the same error, and both times the branch had built and run perfectly on its own preview deployment. Here's what it was, why previews don't catch it, and the check that now stops it reaching production. The symptom Every route returns a 500. Not a slow route, not one endpoint — the whole site. The…
The error "TypeError: __exportAll is not a function" caused a deploy to fail after merging. The issue occurred because the branch had built and run perfectly on its own preview deployment. When merged, the crash appeared because a different set of modules was included, changing how the bundler grouped chunks. This caused a circular ESM import, where one chunk read the helper before the other finished defining it.
The helper was constructed at module load, before any handler ran, resulting in an undefined binding error. The cause was a dynamic import of a module that was already statically imported elsewhere in the same graph. The fix was to delete the dynamic import, using the static one instead. The crash was prevented by two layers of checks during the build: a source scan for dynamic imports of static modules, and an output scan to ensure chunks defining or importing the helper were not on an import cycle.
The general lesson is that a green preview is not a guarantee of a green deploy when the full module graph depends on the build output.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.