fix(electron): point main + preload + index paths at the real build layout
npm run dev failed with ERR_MODULE_NOT_FOUND for dist-electron/services/inputHelper. Root cause: the electron program includes src runtime files (repositories, layoutProfile, ocrPreprocess), so tsc's inferred rootDir is the project root and it emits the entry at dist-electron/electron/main.js (with src at dist-electron/src). package.json "main" still pointed at a stale flat dist-electron/main.js fossil from an older build layout, whose extensionless imports don't resolve under NodeNext ESM. - package.json main -> dist-electron/electron/main.js. - predev/build copy preload.cjs into dist-electron/electron/ (next to main.js, where main.ts resolves it via __dirname). - main.ts loads ../../dist/index.html (one level deeper now) for the packaged window + overlay. Verified: clean electron build emits only the nested layout; electron . loads the main process past module resolution (only ERR_CONNECTION_REFUSED for the dev server, expected standalone); npm run build green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -394,7 +394,7 @@ function createMainWindow() {
|
||||
if (isDev) {
|
||||
mainWindow.loadURL(process.env.VITE_DEV_SERVER_URL!);
|
||||
} else {
|
||||
mainWindow.loadFile(path.join(__dirname, "../dist/index.html"));
|
||||
mainWindow.loadFile(path.join(__dirname, "../../dist/index.html"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,7 +528,7 @@ function createOverlayWindow() {
|
||||
if (isDev) {
|
||||
overlayWindow.loadURL(`${process.env.VITE_DEV_SERVER_URL!}?overlay=1`);
|
||||
} else {
|
||||
overlayWindow.loadFile(path.join(__dirname, "../dist/index.html"), {
|
||||
overlayWindow.loadFile(path.join(__dirname, "../../dist/index.html"), {
|
||||
query: { overlay: "1" },
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user