1

I want to use loki js and I'm trying to call it on that variable, but it appears that the require has not been defined

enter image description here

My package.json

enter image description here

GobsRuiz
  • 199
  • 2
  • 11
  • Does this answer your question? [Javascript require() function giving ReferenceError: require is not defined](https://stackoverflow.com/questions/23603514/javascript-require-function-giving-referenceerror-require-is-not-defined) – Gautham Dec 03 '20 at 13:26
  • Does this answer your question? [Electron require() is not defined](https://stackoverflow.com/questions/44391448/electron-require-is-not-defined) – no ai please Apr 30 '21 at 01:20

1 Answers1

1

There in main.js, I added this line

nodeIntegration: true

inside the function that creates a window

function createWindow () {
const mainWindow = new BrowserWindow({
  width: 800,
  height: 600,
  webPreferences: {
    preload: path.join(__dirname, 'preload.js'),
    nodeIntegration: true, //add this line
  }
})
GobsRuiz
  • 199
  • 2
  • 11