Since version 5.0.0, if i use option inject: false the template parameter bodyTags is returned empty array. Only the headTags parameter is filled(contains both styles and scripts). Version 4.5.0 worked as expected.
bodyTags must contain an array of scripts
webpack.config
plugins: [
new HtmlWebpackPlugin({
inject: false,
template: "./src/template.ejs"
})
]
template
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="root" style="height: 100%"></div>
<%= JSON.stringify(htmlWebpackPlugin.tags) %>
<%= htmlWebpackPlugin.tags.bodyTags %>
</body>
</html>
Node.js v12.20.0
linux 4.4.0-19041-Microsoft
npm 6.14.8
[email protected]
[email protected]
hi @k-ivan
thanks for your feedback
this new behavior was introduced to speed up page load speed and is one of the listed breaking changes
since the release of IE11 all major browser allow to download javascript and to build up the dom in parallel using the defer attribute
the defer loading feature was already part of html-webpack-plugin but was disabled by default to support IE9 & IE10
with 5.x html-webpack-plugin the scriptLoading is set to defer by default but you can set it to blocking to support IE10 & IE9
hi @jantimon !
Thanks for the quick response. Sorry, I completely forgot about the changelog.
Most helpful comment
hi @k-ivan
thanks for your feedback
this new behavior was introduced to speed up page load speed and is one of the listed breaking changes
since the release of IE11 all major browser allow to download javascript and to build up the dom in parallel using the defer attribute
the defer loading feature was already part of html-webpack-plugin but was disabled by default to support IE9 & IE10
with 5.x html-webpack-plugin the
scriptLoadingis set todeferby default but you can set it to blocking to support IE10 & IE9