Skip to content

Vite 5.1 build fails on Node 20.11 #18

@Sheraff

Description

@Sheraff

Going from

breaks the build (though upgrading a single of those 2 does not).

Errors like

  vite v5.1.1 building for production...
  transforming...
  error during build:
  Error: Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:
  (vite:esbuild) transform "/home/runner/work/root/root/shared/src/foo/bar.ts"
  (vite:esbuild) transform "/home/runner/work/root/root/shared/src/env/publicConfig.ts"
  (vite:esbuild) transform "/home/runner/work/root/root/shared/src/sql.ts"
      at process.handleBeforeExit (file:///home/runner/work/root/root/node_modules/.pnpm/rollup@4.9.6/node_modules/rollup/dist/es/shared/node-entry.js:19028:28)
      at Object.onceWrapper (node:events:633:26)
      at process.emit (node:events:[51](https://github.com/Sheraff/root/actions/runs/7846242822/job/21412463925#step:16:54)8:28)

On the latest version of main it's not /shared files, but /server files that seem to be causing a problem.


Bonus weirdness: on latest version of main, it is able to bundle /server files, but only if there is a single import from that repo. As soon as there are multiple, it fails.
=> but there are still multiple imports from /shared, and those don't fail...
=> but if we move all "client+server" api files to /shared, we see the problem in /shared
=> and before, we had the problem with files from /shared (see error sample above)


Trying to replicate on stackblitz, similar setup, no issue: https://stackblitz.com/edit/stackblitz-starters-jba8ju?file=package.json (stackblitz is on node18, but downloading the repro repo and using node 20.11 still doesn't reproduce).


Next steps:

  • try creating a minimal repro, starting from this repo (instead of fresh starting on stackblitz): https://vscode.dev/github/Sheraff/root/tree/vite-build-issue-minimal-repro
  • try removing all aliases, give up on having nice import paths doesn't seem to make a difference
  • wait for future version of Vite?
  • forbid imports from /server in /client, use /shared same problem if we move it all to /shared

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions