From 3a1b77ebd865ccc9948c8a8db832900bb9de16da Mon Sep 17 00:00:00 2001 From: JellyBrick Date: Sun, 26 Nov 2023 23:25:57 +0900 Subject: [PATCH] fix: electron-vite setting Co-authored-by: Su-Yong --- electron.vite.config.ts | 22 +++++++++------------- src/index.ts | 4 ++-- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/electron.vite.config.ts b/electron.vite.config.ts index 1dd2b941..3d558c99 100644 --- a/electron.vite.config.ts +++ b/electron.vite.config.ts @@ -1,4 +1,4 @@ -import { fileURLToPath, URL } from 'node:url'; +import { resolve } from 'node:path'; import { defineConfig, defineViteConfig } from 'electron-vite'; import builtinModules from 'builtin-modules'; @@ -10,6 +10,11 @@ import pluginLoader from './vite-plugins/plugin-loader'; import type { UserConfig } from 'vite'; +const resolveAlias = { + '@': resolve(__dirname, './src'), + '@assets': resolve(__dirname, './assets'), +}; + export default defineConfig({ main: defineViteConfig(({ mode }) => { const commonConfig: UserConfig = { @@ -35,10 +40,7 @@ export default defineConfig({ }, }, resolve: { - alias: { - '@': fileURLToPath(new URL('./src', import.meta.url)), - '@assets': fileURLToPath(new URL('./assets', import.meta.url)), - }, + alias: resolveAlias, }, }; @@ -81,10 +83,7 @@ export default defineConfig({ }, }, resolve: { - alias: { - '@': fileURLToPath(new URL('./src', import.meta.url)), - '@assets': fileURLToPath(new URL('./assets', import.meta.url)), - }, + alias: resolveAlias, }, }; @@ -129,10 +128,7 @@ export default defineConfig({ }, }, resolve: { - alias: { - '@': fileURLToPath(new URL('./src', import.meta.url)), - '@assets': fileURLToPath(new URL('./assets', import.meta.url)), - }, + alias: resolveAlias, }, }; diff --git a/src/index.ts b/src/index.ts index f4afc0eb..977beb95 100644 --- a/src/index.ts +++ b/src/index.ts @@ -363,7 +363,7 @@ async function createMainWindow() { }, 600); } - app.on('render-process-gone', (event, webContents, details) => { + app.on('render-process-gone', (_event, _webContents, details) => { showUnresponsiveDialog(win, details); }); @@ -431,7 +431,7 @@ async function createMainWindow() { return win; } -app.once('browser-window-created', (event, win) => { +app.once('browser-window-created', (_event, win) => { if (config.get('options.overrideUserAgent')) { // User agents are from https://developers.whatismybrowser.com/useragents/explore/ const originalUserAgent = win.webContents.userAgent;