[X] I agree to follow the code of conduct that this project uses.
[X] I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Problem description
In a similar vein to https://github.com/electron/forge/issues/3169, my project requires an additional webpack bundle to function: a target: web bundle served by a webserver. Currently this is very hard to accomplish with WebpackPlugin.
Proposed solution
It'd be really useful to add an "escape hatch" or two to enable custom webpack config. One option would be to add an extraConfig option:
Another option would be to provide hooks for modifying the webpack config for the renderer or main process before they run. This would be the most flexible for projects with complex builds, though care would need to be taken by users when upgrading electron-forge since the webpack config generated isn't expected to be stable.
Alternatives considered
I tried using webpack() programmatically inside generateAssets, but the .webpack folder was deleted afterwards by the webpack plugin (also this approach gives up watch mode)
Using a hacky preload only renderer entry with a custom config almost worked, but the target gets overridden
Eventually I ended up monkeypatching WebpackConfig.getRendererConfig to add my extra webpack config object. This gives me watch mode for free, which is handy.
Pre-flight checklist
Problem description
In a similar vein to https://github.com/electron/forge/issues/3169, my project requires an additional webpack bundle to function: a
target: web
bundle served by a webserver. Currently this is very hard to accomplish withWebpackPlugin
.Proposed solution
It'd be really useful to add an "escape hatch" or two to enable custom webpack config. One option would be to add an
extraConfig
option:Another option would be to provide hooks for modifying the webpack config for the renderer or main process before they run. This would be the most flexible for projects with complex builds, though care would need to be taken by users when upgrading
electron-forge
since the webpack config generated isn't expected to be stable.Alternatives considered
webpack()
programmatically insidegenerateAssets
, but the.webpack
folder was deleted afterwards by the webpack plugin (also this approach gives up watch mode)preload
only renderer entry with a custom config almost worked, but the target gets overriddenEventually I ended up monkeypatching
WebpackConfig.getRendererConfig
to add my extra webpack config object. This gives me watch mode for free, which is handy.Additional information
No response