Foundations and setup
Read the generated project
Identify the main, preload, renderer, and Forge configuration files before changing the application.
8 minute lesson
Before editing, map each generated file to the process that owns it:
src/index.jsstarts the main process and creates the window.src/preload.jsdefines the narrow bridge available to the page.src/renderer.jsruns with the interface.src/index.htmlcontains the page.forge.config.jscontrols packaging and makers.
Open package.json too. The main field points at Forge output, while the scripts run Forge commands.
Trace startup in this order:
npm start
→ Electron Forge configuration
→ bundled main entry
→ BrowserWindow creation
→ preload bundle
→ HTML and renderer bundle
The Forge Webpack plugin supplies entry constants such as MAIN_WINDOW_WEBPACK_ENTRY and MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY. They resolve differently in development and packaged builds. Use them instead of hardcoding a development-server URL or output path.
Do not rename files yet. First follow each entry from package.json to forge.config.js, then into src/.
Add a temporary log to src/index.js and another to src/renderer.js. Run the app and find each message. Main-process output appears in the terminal. Renderer output appears in Chromium DevTools.
Remove both logs. Knowing which process owns a file is the most important Electron debugging skill because errors, APIs, and trust differ at every boundary.
Lesson completed