From cc6951c9570d45f929214831336bec86c72b6d78 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/electron/main/index.ts b/electron/main/index.ts index cf02fc91..2abf0e89 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -1,10 +1,12 @@ 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 //