Skip to content

Instantly share code, notes, and snippets.

@msafi
Last active October 16, 2021 19:17
Show Gist options
  • Save msafi/d1b8571aa921feaaa0f893ab24bb727b to your computer and use it in GitHub Desktop.
Save msafi/d1b8571aa921feaaa0f893ab24bb727b to your computer and use it in GitHub Desktop.
Electron Webpack `require is not defined`

If you're using Webpack to bundle your Electron app and you're getting require is not defined, and you don't want to set nodeIntegration to true for security, change the target of your webpack bundle from electron-renderer to web. That way webpack won't be trying to look for things like require and module in the environment.

I found this solution after reading this comment SimulatedGREG/electron-vue#644 (comment)

@samvv
Copy link

samvv commented Oct 8, 2021

That's what I needed; thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment