contextisolation和require冲突怎么解决呀
veryws opened this issue · comments
goodunions commented
ArcherGu commented
contextIsolation
开启后 electron 就会认为 require
不可用了,所以你开启后就要在前端检查下是否还在调用require
。而且此时 nodeIntegration: true
也没有什么意义了。
contextIsolation
开启后主进程提供的接口应该通过 preload
进行暴露。
goodunions commented
ArcherGu commented
你的前端部分有 import { ipcRenderer } from 'electron'
这样的引入,你的前端应该是和 electron 完全隔离的,所以不要直接从 electron 中引入东西。