-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Current behaviour 💣
The issue is related to the output of html tag's attribute with null value, which was being suppressed in the previous versions.
This behaviour is particularly not wanted, and at some extension, harmful as in my case.
My application is set to use and validate Sub Resource Integrity (aka integrity attribute), which by definition should always contain a value, otherwise, it must be suppressed from the output.
<script defer="defer" src="https://www.googletagmanager.com/gtag/js?id=[GA_ID]" integrity="null" crossorigin="anonymous"></script>Expected behaviour ☀️
Suppression of null/undefined tags, as on v4.
<script defer="defer" src="https://www.googletagmanager.com/gtag/js?id=[GA_ID]" crossorigin="anonymous"></script>Reproduction Example 👾
This is the base setup:
new SriPlugin({
hashFuncNames: ['sha256', 'sha384', 'sha512'],
enabled: isProd,
}),
new HtmlWebpackPlugin({
template: './src/index.html',
title: pkg.title,
inject: true,
minify: {
collapseWhitespace: true,
preserveLineBreaks: false,
},
}),
new HtmlWebpackTagsPlugin({
append: false,
usePublicPath: false,
scripts: [
{
path: `https://www.googletagmanager.com/gtag/js?id=${GOOGLE_ANALYTICS_ID || 'foo'}`,
attributes: { async: true, integrity: false },
},
],
}),Environment 🖥
Node.js: v14.11.0darwin: 20.3.0webpack: v5.21.2webpack-subresource-integrity: v1.5.2html-webpack-tags-plugin: v3.0.0
And of course, html-webpack-plugin: v5.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels