html-webpack-plugin
html-webpack-plugin copied to clipboard
Configure different chunks with different scriptLoading and inject settings
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
Bump. Are there any updates on this? Or is there anything I can do to help get this implemented?
Did anyone find a workaround for this?
Seems like a nice improvement, but I just discovered https://github.com/architgarg/html-webpack-injector, which appears to be a solution for this exact problem