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, // 默认高度(实际会被最大化覆盖) height: 600, // 默认高度(实际会被最大化覆盖)
show: false, // 先隐藏窗口,避免闪烁 show: false, // 先隐藏窗口,避免闪烁
webPreferences: { webPreferences: {
// 更新preload路径为background目录下的preload.js // 修改使用更可靠的方式获取preload路径避免依赖process.cwd()
preload: require("path").join(process.cwd(), "background/preload.js"), preload: path.join(__dirname, 'preload.js'),
nodeIntegration: false, nodeIntegration: false,
contextIsolation: true, contextIsolation: true,
}, },