[BUGFIX] Replacing attribute with html-parser breaks escaping
This commit is contained in:
parent
9435030b99
commit
b943b1d69c
8
index.js
8
index.js
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user