-
-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customizable options for HtmlWebpackPlugin
#2968
Labels
Comments
sgammon
added a commit
to sgammon/electron-forge
that referenced
this issue
Oct 16, 2022
This changeset adds options to entrypoints to support customized operation of the `HtmlWebpackPlugin`. See below for full changeset. Changes enclosed: - Add properties for `output`, `htmlPlugins`, and `htmlOptions` to `WebpackPluginEntryPoint` - Use new options from `Config.ts`, by merging them into their expected places Fixes and closes electron#2968.
sgammon
added a commit
to sgammon/electron-forge
that referenced
this issue
Oct 16, 2022
This changeset adds options to entrypoints to support customized operation of the `HtmlWebpackPlugin`. See below for full changeset. Changes enclosed: - Add properties for `output`, `htmlPlugins`, and `htmlOptions` to `WebpackPluginEntryPoint` - Use new options from `Config.ts`, by merging them into their expected places Fixes and closes electron#2968.
5 tasks
sgammon
added a commit
to sgammon/electron-forge
that referenced
this issue
Oct 16, 2022
This changeset adds options to entrypoints to support customized operation of the `HtmlWebpackPlugin`. See below for full changeset. Changes enclosed: - Add properties for `output`, `htmlPlugins`, and `htmlOptions` to `WebpackPluginEntryPoint` - Use new options from `Config.ts`, by merging them into their expected places - Add tests to cover new options Fixes and closes electron#2968.
erickzhao
added
plugin/webpack
Issues or pull requests related to first-party webpack plugins/templates
enhancement
labels
Oct 16, 2022
sgammon
added a commit
to sgammon/electron-forge
that referenced
this issue
Oct 16, 2022
This changeset adds options to entrypoints to support customized operation of the `HtmlWebpackPlugin`. See below for full changeset. Changes enclosed: - Add properties for `output`, `htmlPlugins`, and `htmlOptions` to `WebpackPluginEntryPoint` - Use new options from `Config.ts`, by merging them into their expected places - Add tests to cover new options Fixes and closes electron#2968.
sgammon
added a commit
to sgammon/electron-forge
that referenced
this issue
Oct 16, 2022
This changeset adds options to entrypoints to support customized operation of the `HtmlWebpackPlugin`. See below for full changeset. Changes enclosed: - Add properties for `output`, `htmlPlugins`, and `htmlOptions` to `WebpackPluginEntryPoint` - Use new options from `Config.ts`, by merging them into their expected places - Add tests to cover new options Fixes and closes electron#2968.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Pre-flight checklist
Problem description
I want to adjust the output from
HtmlWebpackPlugin
, or use addons with it via the@electron-forge
Webpack plugin. But, because@electron-forge/plugin-webpack
uses theHtmlWebpackPlugin
privately, and no such options are provided, the plugin invocation cannot be adjusted.As a user, I still want to leverage
@electron-forge
's built-in configuration ofHtmlWebpackPlugin
, just with adjusted parameters and extra add-ons.Additionally, some plugins need to be invoked only when the HTML plugin is invoked, which leaves no opportunity in the existing Forge configuration structure to safely declare the plugin.
Proposed solution
I would like to propose three new properties to be added to
WebpackConfig.ts
:Config.ts
:These options would be passed to the
HtmlWebpackPlugin
invocation viaObject.assign(...)
, like so:Config.ts
:Then, in
forge.config.js
, the user can control these parameters:forge.config.js
:Alternatives considered
I have considered:
1) Suppressing HTML features in
@electron-forge/plugin-webpack
.This is sub-optimal because the plugin still drives chunking, entrypoints, etc., and is very useful in this regard. I don't want to have to make a trade-off decision between these benefits and custom options.
2) Mounting as regular plugins.
When I try to use HTML plugin add-ons as regular plug-ins, they end up in the plugin list after
HtmlWebpackPlugin
, and so their output isn't picked up.3) Patching.
We're doing this currently via Yarn and it's working great, but this limits the benefits only to us and forces maintenance of the patch. The plugin's approach is solid, it just needs extra options to allow users to get in there and customize the invocation.
Additional information
No response
The text was updated successfully, but these errors were encountered: