Missing webpack directories after executing npm init electron-app@latest testApp -- --template=webpack

I am trying to create an Electron app using the command npm init electron-app@latest testApp -- --template=webpack, but it does not generate the expected webpack directories. While following a tutorial, I noticed that others successfully obtain these folders immediately after running the same command. I have attempted to install webpack and webpack-cli manually, but the folders still do not show up. What could be causing this issue?

The issue you are facing might occur because the electron-forge templates have been updated, and they may not automatically include webpack configuration as you expect. You might want to manually set up webpack by first checking if electron-forge is properly installed by running npm ls electron-forge to ensure it’s in the project dependencies. If not, install it using npm install --save-dev @electron-forge/cli. After that, try scaffolding the webpack config using npm run make, which should help generate the necessary config files and directories for webpack integration.

I encountered a similar problem a while back, and it turned out that the templates available through electron-forge sometimes change, particularly when they’re updated to align with the latest practices or dependencies. One thing you might want to try is manually setting up a basic webpack configuration from scratch if the default template isn’t meeting your needs. Start with creating a webpack.config.js file, and include some basic configuration to get it running with Electron. Sometimes starting from a minimal setup allows better customization and comprehension. Additionally, make sure all your dependencies for Electron and Webpack are compatible with each other in terms of version numbers. It’s also a good idea to double-check the documentation of the electron-forge version you’re using to see if there’s any mention of changes in the webpack template setup.