Electron 'window' is not defined
It looks like the relevant Javascript you are referencing is running in the main process rather than the renderer processes. If you move the code that references window
into a script tag in the html you shouldn't see the same issue.
As far as requiring the files from the html page I would expect it to work as if it were in a script tag also. I could be mistaken though.