Bug
vinext build fails in GitHub Actions (Ubuntu runner) with:
failed to load config from /home/runner/work/.../apps/web/vite.config.ts
Error: Dynamic require of "file:///home/runner/work/.../node_modules/@cloudflare/vite-plugin/dist/index.mjs" is not supported
at file:///.../apps/web/node_modules/.vite-temp/vite.config.ts.timestamp-xxx.mjs:5:9
Environment
- vinext: 0.0.13
- Node: 22.x (GitHub Actions ubuntu-latest)
- React: 19.2.0
- Next.js: 15.2.x
- Package manager: Yarn 1 (monorepo workspaces)
Steps to reproduce
- Set up a Next.js app with
vite.config.ts using @cloudflare/vite-plugin
- Run
vinext build in a GitHub Actions CI environment (ubuntu-latest, Node 22)
- Build fails immediately — the vite config cannot be loaded
Root cause
The vite.config.ts generated/used by vinext imports @cloudflare/vite-plugin via CommonJS require(). In Node 22's strict ESM context on Linux CI runners, dynamic require() of an .mjs file is not supported.
Workaround
Use next build followed by wrangler deploy separately instead of vinext build / vinext deploy:
next build && wrangler deploy
This bypasses vinext's Vite layer for the build step entirely.
Expected behavior
vinext build should work in standard CI environments (GitHub Actions, ubuntu-latest, Node 22) without requiring workarounds.