在index.html中引入的js不能用require方法,只能用src引入;然后在引入的这个js中也不能使用require方法?

来源:2-3 进程间通信

qq_慕圣3006777

2021-10-20

在index.html中引入的js不能用require方法,只能用src引入;然后在引入的这个js中也不能使用require方法?
图片描述

写回答

1回答

Beep_beep

2021-11-03

const mainWindow = new BrowserWindow({

    ...

    webPreferences:{

        nodeIntegrantion: true,

        contextIsolation:false

    }

})


需要在  mainWindow  webPreferences  中,添加   contextIsolation:false  这段代码

5
0

深度实战Electron,开发本地音乐播放器

慕课网首门 Electron 课程,专注应用核心开发

2347 学习 · 32 问题

查看课程