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

Electron Security Warning #16

Open
jasford opened this issue Apr 3, 2018 · 1 comment
Open

Electron Security Warning #16

jasford opened this issue Apr 3, 2018 · 1 comment

Comments

@jasford
Copy link

jasford commented Apr 3, 2018

Thanks for creating this! I followed the walkthrough blog post and when I run the app in development mode (npm start) and open the console from inside the app, I see this warning:

image

I think this is being triggered by the live reload parts of NextJS—so I think this is more of a false-flag warning, but I would like to not just get in the habit of ignoring that warning since it would be useful to know if I accidentally introduced a security hole by loading external content outside of a ` in my actual app.

I tried turning off nodeIntegration since I don't need it for my app, like this:

  mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: { nodeIntegration: false},
  })

But that just got me a full-blown error in the console:

image

Any ideas on how to get the hot reload to run locally so this warning is not triggered and/or so we could run with nodeIntegration: false?

@HaNdTriX
Copy link

HaNdTriX commented May 15, 2018

This is because your webpack target is electron-renderer so webpack assumes require is defined.

Solutions

Change your webpack.target (recommended)

Change your webpack.target to be web (See next.config.js).

Docs | Code

Enable nodeIntegration

Or you can enable nodeIntegration in your WebView/BrowserWindow and remove the warnings by setting ELECTRON_DISABLE_SECURITY_WARNINGS on either process.env or the window object.

Docs

For a full example check out vercel/next.js#4386

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

2 participants