Skip to content

fix: mark the compiled server packages as ES modules - #5

Merged
spacedevin merged 1 commit into
mainfrom
fix/esm-node-modules
Oct 8, 2026
Merged

spacedevin merged 1 commit into
mainfrom
fix/esm-node-modules

Conversation

@spacedevin

Copy link
Copy Markdown
Member

On Vercel, every server route of moo.moi's preview (/callback, and the 404 page) failed with:

SyntaxError: Named export 'Fragment' not found. The requested module '../node_modules/@tishlang/orbit/src/main.js' is a CommonJS module

tish writes the compiled packages under .orbit/server/…/node_modules (@tishlang/orbit, tishdoc-*) with no package.json. Node never looks past a node_modules folder for one, so the files count as CommonJS. Plain node (22 and 26) guesses ES modules from the syntax, which is why this didn't reproduce locally. Vercel's launcher doesn't guess.

compileEsm now writes {"type": "module"} into every package folder under any node_modules in the compiled tree. The end-to-end test checks that none are left unmarked.

Checked locally:

  • npm run lint is clean.
  • npm test passes (25).
  • npm run test:e2e passes, including the new check.

tish writes the compiled packages under .orbit/server/.../node_modules (@tishlang/orbit, tishdoc-*) without a package.json. Node never looks past a node_modules folder for one, so it takes them for CommonJS; Vercel's Node 22 runtime then failed every server route with "Named export 'Fragment' not found" (moo.moi's /callback and 404). compileEsm now writes {"type": "module"} into every package folder under any node_modules in the compiled tree.
@spacedevin
spacedevin merged commit 07dc207 into main Oct 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant