From b0d469b1323394c892528601560f7d8f719a68f8 Mon Sep 17 00:00:00 2001 From: chenqiang Date: Wed, 10 Sep 2025 09:08:03 +0800 Subject: [PATCH] =?UTF-8?q?preload=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- background/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/background/main.js b/background/main.js index 37252d1..a95dd82 100644 --- a/background/main.js +++ b/background/main.js @@ -47,8 +47,8 @@ async function createWindow() { height: 600, // 默认高度(实际会被最大化覆盖) show: false, // 先隐藏窗口,避免闪烁 webPreferences: { - // 更新preload路径为background目录下的preload.js - preload: require("path").join(process.cwd(), "background/preload.js"), + // 修改:使用更可靠的方式获取preload路径,避免依赖process.cwd() + preload: path.join(__dirname, 'preload.js'), nodeIntegration: false, contextIsolation: true, },