问题描述:
本人在使用jQuery编写前端界面导航栏切换功能,由于项目需要,使用electron进行打包并处理本地数据库。在主进程创建窗口的代码中有一下代码:
webPreferences:{
// 渲染进程 开启node模块,使得JS中可以使用node的model
nodeIntegration:true,
// 控制上下文隔离
contextIsolation:false,
}
由于本人需要直接在其他js脚本中直接引用Node.js的模块,所以关闭了上下文隔离。
运行后在前端控制台会显示如下错误:
bootstrap.min.js:6 Uncaught Error: Bootstrap's JavaScript requires jQuery
at bootstrap.min.js:6:37
index.html:20 Uncaught ReferenceError: $ is not defined
at index.html:20:13
jquery.nouislider.js:1056 Uncaught ReferenceError: jQuery is not defined
at jquery.nouislider.js:1056:
在 Electron 中使用 jQuery 與網頁偵錯技巧-黑暗執行緒
在上述网站中找到解决方案,其提供的方法是将node.js的r