preload路径

This commit is contained in:
chenqiang 2025-09-10 09:08:03 +08:00
parent 8c75631d4a
commit b0d469b132

View File

@ -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,
},