electron 5.0.0 “Uncaught ReferenceError: require is not defined”

前端 未结 6 885
难免孤独
难免孤独 2020-12-24 06:06

I had initially been using electron stable (4.x.x), and was able to use require in both my browser and renderer processes. I upgraded to electron beta (5.0.0) b

6条回答
  •  一生所求
    2020-12-24 06:48

    It turns out, nodeIntegration was true by default in previous electron versions, but false by default in 5.0.0. Consequently, setting it to true resolved my issue. Not finding this change documented online in comments or on electrons page, I thought I'd make this self-answered SO post to make it easier to find for future people who encounter this issue.

提交回复
热议问题