Hello all,
I’m usually the type to just go figure things out myself, but I’m dealing with layers of stuff I don’t fully understand, and I think I need help.
The things I don’t have a great understanding of are webpack/commonJS/import
s/require
s. I get the basics of them, but now that I have some code using import
and some using require
I don’t know how to resolve my problems. (I’ve been out of web dev for several years, so the massive stack of build tools stuff has gotten away from me a bit.)
I have a phaser game I built starting with the create-phaser-game
repo https://github.com/phaserjs/create-game. This repo uses import
statements everywhere and is webpack
-based.
(You can play the game at https://bescarfed.com/)
I am trying to wrap it up in electron, as advised so I can make an executable (hopefully for Steam eventually), and I’m trying to copypasta-and-adapt the code in electron-boilerplate
https://github.com/sindresorhus/electron-boilerplate. This repo uses require
statements.
Now I’m stuck in this weird state where I’m getting an unhandled exception error from the node_module
called electron-util
telling me to change an import statement to a require statement. That doesn’t seem right, so I must have a problem somewhere else.
I tried switching out the require
s in electron-main.js
to import
s but then I get this error:
Like I said, I’d normally go investigate myself and figure this out, but I’m honestly not even sure what to start researching or even where to start looking to get a better grasp on what’s happening here. Can anyone help me?
I’m honestly not even sure what pieces of information I would need to share to help me get this resolved, so if there are any questions, I’ll try to get back to you quickly.
Ideally, I’d like to be able to use separate script commands to build for web and build for electron.