Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught ReferenceError: require is not defined at main.html:5 #11

Open
iCrashed opened this issue Jul 9, 2020 · 2 comments
Open

Uncaught ReferenceError: require is not defined at main.html:5 #11

iCrashed opened this issue Jul 9, 2020 · 2 comments

Comments

@iCrashed
Copy link

iCrashed commented Jul 9, 2020

The line
const electron = require("electron");

in the client script is giving me the error

@LuC4SC4S
Copy link

LuC4SC4S commented Jul 9, 2020

Verify if your BrowserWindow function has the webPreferences value, with a nodeIntegrations: true. It will resolve your problem with the error of require.
See more here
https://stackoverflow.com/questions/44391448/electron-require-is-not-defined

@tgmarinho
Copy link

Try this as @LuC4SC4S said.

  let mainWindow = new BrowserWindow({
    height: 800,
    width: 800,
    show: false,
    webPreferences: {
      nodeIntegration: true,
    },
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants