From f06b279554422c1dbf52fe934350a974b5f85dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leo=20Wang=28=E8=8D=89=E9=9E=8B=E6=B2=A1=E5=8F=B7=29?= <308487730@qq.com> Date: Sun, 21 Apr 2024 09:39:09 +0800 Subject: [PATCH] chore: remove `globalThis.__dirname` --- electron/main/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/electron/main/index.ts b/electron/main/index.ts index cf02fc91..a95a3a26 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -1,10 +1,11 @@ import { app, BrowserWindow, shell, ipcMain } from 'electron' +import { createRequire } from 'node:module' import { fileURLToPath } from 'node:url' import path from 'node:path' import os from 'node:os' -globalThis.__filename = fileURLToPath(import.meta.url) -globalThis.__dirname = path.dirname(__filename) +const require = createRequire(import.meta.url) +const __dirname = path.dirname(fileURLToPath(import.meta.url)) // The built directory structure //