diff --git a/electron/main/index.ts b/electron/main/index.ts index 76cf34d..e130720 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -16,7 +16,7 @@ process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true' let win: BrowserWindow | null = null // Here, you can also use other preload -const splash = join(__dirname, '../preload/splash.js') +const index = join(__dirname, '../preload/index.js') // 🚧 Use ['ENV_NAME'] avoid vite:define plugin const url = `http://${process.env['VITE_DEV_SERVER_HOST']}:${process.env['VITE_DEV_SERVER_PORT']}` @@ -24,7 +24,7 @@ async function createWindow() { win = new BrowserWindow({ title: 'Main window', webPreferences: { - preload: splash, + preload: index, nodeIntegration: true, contextIsolation: false, }, @@ -77,7 +77,7 @@ app.on('activate', () => { ipcMain.handle("open-win", (event, arg) => { const childWindow = new BrowserWindow({ webPreferences: { - preload: splash, + preload: index, }, }) diff --git a/electron/preload/splash.ts b/electron/preload/index.ts similarity index 100% rename from electron/preload/splash.ts rename to electron/preload/index.ts diff --git a/vite.config.ts b/vite.config.ts index be4c762..d566654 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -23,7 +23,7 @@ export default defineConfig({ preload: { input: { // You can configure multiple preload here - splash: join(__dirname, 'electron/preload/splash.ts'), + index: join(__dirname, 'electron/preload/index.ts'), }, vite: { build: {