-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Description
Production builds fail during the prerendering step when Vite outputs ES module files with .mjs extensions instead of .js.
Error:
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/path/to/dist/server/entry.server.js'
❌ Build failed: Could not find server config output file
Root Cause
Two files have hardcoded .js extensions:
dist/config/loader.js:58 - looks for zudoku.config.js
dist/vite/prerender/prerender.js:19 - looks for entry.server.js
But Vite outputs .mjs files, causing the lookups to fail.
Environment
Zudoku: 0.67.0
Vite: 6.4.1
Yarn: 4.9.4
Node: 22.12.0
Reproduction
Use Zudoku with default Vite configuration
Run yarn build
Build fails during prerendering step
Suggested Fix:
// loader.js line 58
const result = output.output.find((o) =>
"isEntry" in o && o.isEntry &&
(o.fileName === "zudoku.config.js" || o.fileName === "zudoku.config.mjs")
);
// prerender.js line 19
const entryServerMjs = path.join(distDir, "server/entry.server.mjs");
const entryServerJs = path.join(distDir, "server/entry.server.js");
const entryServerExists = await fileExists(entryServerMjs);
const entryServerPath = pathToFileURL(entryServerExists ? entryServerMjs : entryServerJs).href;
Workaround used
For Yarn 4+ users, you can create a patch:
- Run
yarn patch zudoku - Apply the fixes shown in the "Suggested Fix" section above
- Run
yarn patch-commit -s /path/from/yarn/output
This will generate a patch file that automatically applies on yarn install.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels