v5.5.0 contains breaking change with type attribute having undefined value
StephanBijzitter opened this issue · 3 comments
StephanBijzitter commented
Current behaviour 💣
When using a custom template (and injecting tags/attributes manually), v5.5.0 has introduced a breaking change where the "type" attribute can be present with a value of undefined
. In my case, this result in the rendering of type="undefined"
, preventing all scripts from being loaded by the browser.
htmlWebpackPlugin.tags.bodyTags[0].attributes
// {type: undefined, otherStuff: ...}
Expected behaviour ☀️
Like v5.4.0: attributes with an undefined
value should not be present in the attributes
object.
htmlWebpackPlugin.tags.bodyTags[0].attributes
// {otherStuff: ...}
Reproduction Example 👾
Not applicable.
Environment 🖥
- v5.4.0 is okay
- v5.5.0 is the first version to have
undefined
values
StephanBijzitter commented
I've added:
Object.entries(attributes)
.filter(([key, val]) => val !== undefined)
... rest of code
to my template for now, as that's easy enough, but I do believe this should be addressed in v5.5.1
jantimon commented
Oh thanks for the input - I guess that's from this change: 1e42625
type: options.scriptLoading === 'module' ? 'module' : undefined,
could be changed to a spread logic:
...( options.scriptLoading === 'module' ? { type: 'module' } : {})
StephanBijzitter commented
That would definitely work :-)