egoist / template-electron

Scaffold out an Electron app.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"electron-renderer" causes `ReferenceError: require is not defined`

johnlindquist opened this issue · comments

Reproduce:

  1. Generate this template while selecting "Yes" to use Webpack
  2. npm run dev
  3. Open localhost:4000 to see error.

Switching config.target = "web" causes the error to go away, but I don't think that "solves" the issue.

Uncaught ReferenceError: require is not defined
    at eval (external "url":1)
    at Object.url (client.js:197)
    at __webpack_require__ (manifest.js:712)
    at fn (manifest.js:117)
    at Object.eval (index.js:6)
    at eval (index.js:225)
    at Object.../../../../usr/local/lib/node_modules/poi/node_modules/webpack-dev-server/client/index.js?/ (vendor.js:981)
    at __webpack_require__ (manifest.js:712)
    at fn (manifest.js:117)
    at eval (dev-client.es6:2)

Sorry that I can't help fix beyond that. I've been googling without any luck on how to hunt this down.

maybe we should disable that Open localhost:4000 log in electron mode 😅 instead you should run npm run app

Ah, I see.

npm run both loaded with a blank electron screen (so I thought it was "broken"). I just had to refresh after localhost:4000 compiled (I assumed localhost:4000 was broken because of that error :)).

Thanks!