[BUGFIX] Replacing attribute with html-parser breaks escaping

This commit is contained in:
Philipp Dieter 2021-11-02 00:56:50 +01:00
parent 9435030b99
commit b943b1d69c

View File

@ -39,15 +39,17 @@ HtmlWebpackAlterDataPlugin.prototype.apply = function (compiler) {
if (!attribute) {
continue;
}
var attributeReplace = attribute;
for (var [source, target] of Object.entries(manifest)) {
attribute = attribute.replace(
attributeReplace = attributeReplace.replace(
this.options.assetPrefix + source + '#',
target + '#',
)
}
node.setAttribute('xlink:href', attribute);
// Just use replace as using html pasrser to set attribute breaks the
// js module escaping
result = result.replace(attribute, attributeReplace);
}
var result = root.toString();
compilation.assets[basename] = new RawSource(result);
}
}