samedi 29 septembre 2018

Electron: Why occurs 'Uncaught ReferenceError: require is no defined.'?

I have to occur some problem when I develop program by using 'Electron'.

First, I was typing require() code in 'main.js'.

const { app, BrowserWindow, globalShortcut, Menu, ipcMain } = require('electron')

Above code is no error from console. And I have creating another source file 'func.js'.

I was typing require() code in 'func.js'.

const { ipcRenderer, remote } = require('electron')

But above code is occur error from console.

So I don't know what is wrong. The ES6 script uses the import () statement, but I do not really know if there was an error in 'main.js', but I do not know why other files fail.




Aucun commentaire:

Enregistrer un commentaire