question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Electron 13 + Webpack -> require is not defined

See original GitHub issue

After updating plugin to 2.1.0 and Electron to 13.1.4 on app startup getting following error visible in console:

external "events"?7a7e:1 Uncaught ReferenceError: require is not defined at eval (external "events"?7a7e:1) at Object.events (app.js:3462) at __webpack_require__ (app.js:790) at fn (app.js:151) at eval (emitter.js?a6bd:1) at Object../node_modules/webpack/hot/emitter.js (chunk-vendors.js:22893) at __webpack_require__ (app.js:790) at fn (app.js:151) at eval (dev-server.js?6895:50) at Object../node_modules/webpack/hot/dev-server.js (chunk-vendors.js:22882)

Problematic line in node_modules/webpack/hot/dev-server.js var hotEmitter = require("./emitter");

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
nklaymancommented, Jul 28, 2021

Electron is replacing nodeIntegration=true with contextIsolation=false. I think that was causing your issue as it would explain why upgrading electron broke it and adding contextIsolation=false fixed it.

0reactions
blogwycommented, Feb 10, 2022

Electron is replacing nodeIntegration=true with contextIsolation=false. I think that was causing your issue as it would explain why upgrading electron broke it and adding contextIsolation=false fixed it.

doc not update

Read more comments on GitHub >

github_iconTop Results From Across the Web

Electron Webpack `require is not defined` - Github-Gist
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...
Read more >
'Require is not defined' when adding electron-renderer to ...
I understand that adding the following line to my Webpack config would allow me to import electron on the renderer side. module.exports =...
Read more >
How to solve require is not defined in electronjs - YouTube
How to solve require is not defined in electron js ?Solution:I have solved this issue by updating ElectronJs VersionLet Update it to the ......
Read more >
uncaught referenceerror: require is not defined - You.com
If you are getting an Uncaught ReferenceError: require is not defined error, it likely means that you are attempting to use the require()...
Read more >
electron referenceerror require is not defined Code Example
This can happen if: * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found