我有一个基本的Electron/Svelte应用程序,我正在尝试使用nedb添加数据库功能。如果我使用let Datastore = require("nedb"),我会得到一个错误,"Uncaught : require is not defined“。我能找到的最好的建议是使用import,但使用import Datastore from 'nedb'时,我得到了错误消息"Uncaught : util is not defined at main.js:6“。有什么想法?
发布于 2021-03-02 23:18:29
找到了。需要在新BrowserWindow()的参数中将nodeIntegration设置为true
mainWindow = new BrowserWindow({
width: 900,
height: 680,
webPreferences: {
nodeIntegration: true
}
});https://stackoverflow.com/questions/66441364
复制相似问题