jantimon / jantimon/html-webpack-plugin
Configure different chunks with different scriptLoading and inject settings
- Dominant language
- JavaScript
- Stars
- 10.7k
- Forks
- 1.3k
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
I have a use case where I want to load multiple scripts on the same page. Some should be loaded synchronously, before the dom, others should use `defer`
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
The `chunks` option should allow an object where I can override the default values of `scriptLoading` and `inject` (and possibly others)
```
new HTMLWebpackPlugin({
chunks: {
setup: { scriptLoading: 'blocking' },
main: {},
}
});
```
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
I can merge the two scripts into one, and put the code that depends on the dom inside of an event listener.
**Additional context**
Add any other context or screenshots about the feature request here.
The script I want to load first contains custom elements. The other script "hydrates" those custom elements. I want to load the custom elements before the dom so that I don't have a flash of unstyled content
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the HTMLWebpackPlugin configuration and its chunks, scriptLoading, and inject options. Trace how chunk-specific settings would be represented and applied, then verify that setup can use blocking while main retains its default behavior without breaking existing configurations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, webpack
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100