refactor(app): migrate to ESM; preload emitted as CJS for sandbox (Phase 5d-3b)
App source (main/preload/worker/renderer) -> ESM; app is now type: module; __dirname via import.meta.url; worker spawned with type module. Preload is built as CJS (electron-vite output format) because the sandboxed renderer does not support ESM preload; main loads ../preload/index.js. Removed dead imports (nativeImage, readline) and the obsolete scripts/dev.js. Tests: 4 app tests require->import; app-main-settings rewritten with node:test mock.module + dynamic import (replacing CJS Module._load mocking); test script adds --experimental-test-module-mocks. electron-vite build clean, 119/119, and npm run dev verified: app launches, preload bridges IPC, data loads.
This commit is contained in:
+3
-5
@@ -46,16 +46,13 @@
|
||||
"out/**"
|
||||
],
|
||||
"asarUnpack": [
|
||||
"**/node_modules/better-sqlite3/**"
|
||||
"node_modules/better-sqlite3/**/*"
|
||||
],
|
||||
"extraResources": [
|
||||
{
|
||||
"from": "../scripts/schema.sql",
|
||||
"to": "scripts/schema.sql"
|
||||
}
|
||||
],
|
||||
"asarUnpack": [
|
||||
"node_modules/better-sqlite3/**/*"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -70,5 +67,6 @@
|
||||
"vite": "^6.0.0",
|
||||
"vue": "^3.4.0",
|
||||
"vue-router": "^4.3.0"
|
||||
}
|
||||
},
|
||||
"type": "module"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user