diff --git a/.vscode/launch.json b/.vscode/launch.json index a53b0fc..15a1e53 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -30,7 +30,7 @@ }, "runtimeArgs": [ "--remote-debugging-port=9229", - "${workspaceRoot}/dist/main/index.cjs" + "${workspaceRoot}/dist/electron/main/index.cjs" ], "envFile": "${workspaceFolder}/.vscode/.debug.env" }, diff --git a/electron/main/index.ts b/electron/main/index.ts index 3312c09..30a395a 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -15,9 +15,9 @@ if (!app.requestSingleInstanceLock()) { process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true' let win: BrowserWindow | null = null -// Here, you can also use other preload +// Here you can add more preload scripts const splash = join(__dirname, '../preload/splash.js') -// 🚧 Use ['ENV_NAME'] avoid vite:define plugin +// 🚧 Use ['ENV_NAME'] to avoid vite:define plugin const url = `http://${process.env['VITE_DEV_SERVER_HOST']}:${process.env['VITE_DEV_SERVER_PORT']}` async function createWindow() { diff --git a/electron/preload/splash.ts b/electron/preload/splash.ts index ea48210..90c0647 100644 --- a/electron/preload/splash.ts +++ b/electron/preload/splash.ts @@ -1,4 +1,3 @@ - function domReady(condition: DocumentReadyState[] = ['complete', 'interactive']) { return new Promise(resolve => { if (condition.includes(document.readyState)) { diff --git a/src/global.d.ts b/src/global.d.ts index 8d1a260..677ff6f 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -1,9 +1,8 @@ - export { } declare global { interface Window { - // Expose some Api through preload script + // Expose API through preload script fs: typeof import('fs') ipcRenderer: import('electron').IpcRenderer removeLoading: () => void diff --git a/types.d.ts b/types.d.ts index b435aec..7d79242 100644 --- a/types.d.ts +++ b/types.d.ts @@ -1,4 +1,3 @@ - declare namespace NodeJS { interface ProcessEnv { NODE_ENV: 'development' | 'production'