我通过 Electron 打包了我们的 JS Web 应用程序.
当我尝试启动此打包应用程序时出现以下错误:
text.js: Uncaught TypeError: require.nodeRequire is not a function
我们的 RequireJS 版本中没有函数 nodeRequire。
据我了解,NodeJS 的 RequireJS 版本与浏览器的 RequireJS 版本不同。
我应该怎么做才能解决这个问题?
我应该在我们的网络应用程序中使用其他版本的 RequireJS 吗?
或者是否可以配置 Electron 来避免此错误?
最佳答案
Electron 提供了一个适合我的配置。
// In the main process
var mainWindow = new BrowserWindow({
webPreferences: { nodeIntegration: false }
});
关于javascript - 无法启动 Electron 打包的 JS 应用程序。未捕获的 TypeError : require. nodeRequire 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38147438/