build-electron
build-electron copied to clipboard
Where do I put my HTML file?
Hi. I am new to Electron and I am using your solution to use ESM and CommonJS modules. THANK YOU for building that.
Everything works when I run this code in VS Code in debug mode, but I am not having luck when the project is built into an executable file. The EXE is complaining that it can't find the HTML files, and I do not see them anywhere in the dist folder. How do I copy the files, so that when the project is built the files are also copied?
If the HTML file is compiled, then how to I load the file in the window.loadFile(homepage);?
Thanks
Hi. You can use some frontend build tool like create-react-app or vite. Then maybe something like this:
const url = new URL(isDev ? 'http://localhost:3000' : `file://${path.join(__dirname, '../vite-dist/index.html')}`);