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)
Thank you so much! It worked for me too