electron iframe require is not defined

JavaScript
iframe.onload = function () {
  const iframeWin = iframe.contentWindow
  iframeWin.require = window.require
})
Source

Also in JavaScript: