mainConfig
, and one for the renderer process in renderer.config
. The complete config options are available at WebpackPluginConfig
. For example, in your Forge configuration:nodeIntegration
to true
in a given renderer's BrowserWindow
constructor, you'll need to set the same nodeIntegration
value in the corresponding Webpack plugin renderer's configuration:devContentSecurityPolicy
in your Forge Webpack plugin configuration (note that it is separate from the main and renderer configuration):'unsafe-eval'
for the script-src
directive. Using 'unsafe-eval'
will cause Electron itself to trigger a warning in the DevTools console about having that value enabled, which is usually fine so long as you do not set that value in production.webpack-dev-server
options by setting devServer
in your Forge Webpack plugin configuration (note that it is separate from the main and renderer configuration):main
entry in your package.json
file needs to point at "./.webpack/main"
like so:loadURL
and preload
paths need to reference the entry points' magic global variables that this plugin will define for you. Each entry point has two globals defined: one suffixed with _WEBPACK_ENTRY
, and the other suffixed with _PRELOAD_WEBPACK_ENTRY
. These point to the paths for your renderer entry point and your preload script path, respectively. In the case of the main_window
entry point in the earlier example, the global variables will be named MAIN_WINDOW_WEBPACK_ENTRY
and MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY
. An example of how to use them is given below:module.rules
configuration in your Webpack config. Ensure you install both node-loader
and @vercel/webpack-asset-relocator-loader
as development dependencies.@marshallofsound/webpack-asset-relocator-loader
. It is recommended to remove the fork and migrate to @vercel/webpack-asset-relocator-loader
.rs
in the console you launched electron-forge
from and we will restart your app for you with the new main process code.webpack-dev-server
instances to power your renderer processes, in prod we just build the static files. Assuming you use the globals we explained in Project Setup, everything should Just Workâ„¢ when your app is packaged.react-router
to do virtual routing in your app, you will need to ensure you use a history method that is not based on the browser history APIs. Browser history will work in development but not in production, as your code will be loaded from the filesystem, not a webserver. In the react-router
case, you should use the MemoryRouter
to make everything work.