+\`;
// Exports
export default code;"
`;
@@ -33,7 +37,8 @@ var ___HTML_LOADER_IMPORT_1___ = new URL("./image.png", import.meta.url);
// Module
var ___HTML_LOADER_REPLACEMENT_0___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___);
var ___HTML_LOADER_REPLACEMENT_1___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_1___);
-var code = "
+\`;
// Exports
export default code;"
`;
@@ -53,7 +58,11 @@ import ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___ from "../../src/runtime/getUrl.j
var ___HTML_LOADER_IMPORT_0___ = new URL("./image.png", import.meta.url);
// Module
var ___HTML_LOADER_REPLACEMENT_0___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___);
-var code = "
\\n
Alexander Krasnoyarov
\\n
\\n
\\n";
+var code = \`
+
Alexander Krasnoyarov
+
+
+\`;
// Exports
export default code;"
`;
@@ -78,7 +87,8 @@ var ___HTML_LOADER_IMPORT_1___ = new URL("./image.png", import.meta.url);
// Module
var ___HTML_LOADER_REPLACEMENT_0___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___);
var ___HTML_LOADER_REPLACEMENT_1___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_1___);
-var code = "
\\n";
+var code = \`
+\`;
// Exports
export default code;"
`;
diff --git a/test/__snapshots__/sources-option.test.js.snap b/test/__snapshots__/sources-option.test.js.snap
index 12a75a23..5b21e9ef 100644
--- a/test/__snapshots__/sources-option.test.js.snap
+++ b/test/__snapshots__/sources-option.test.js.snap
@@ -67,13 +67,7 @@ var ___HTML_LOADER_REPLACEMENT_31___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(
var ___HTML_LOADER_REPLACEMENT_32___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_23___);
var ___HTML_LOADER_REPLACEMENT_33___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_24___);
var ___HTML_LOADER_REPLACEMENT_34___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_25___);
-var code = "\\n\\n
My First Heading
\\n
My first paragraph.
\\n
An Unordered HTML List
\\n\\n
\\n - Coffee
\\n - Tea
\\n - Milk
\\n
\\n\\n
An Ordered HTML List
\\n\\n
\\n - Coffee
\\n - Tea
\\n - Milk
\\n
\\n\\n<" + "script>console.log({\\"json\\": \\"with \\\\\\"quotes\\\\\\" in value\\"})<" + "/script>\\n\\n\\n\\n
Foo
\\n\\n\\n
BAR
\\n\\n
\\n\\n<" + "script> console.log(1 + 2 + \`\${3 + 3}\`) <" + "/script>\\n\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n\\n<" + "script src=\\"" + ___HTML_LOADER_REPLACEMENT_4___ + "\\"><" + "/script>\\n\\n
\\n
\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n
"
`;
-exports[`'sources' option should process attributes specific to a tag and attributes for any tag: warnings 1`] = `[]`;
+exports[`'sources' option should work by default with ES module syntax: warnings 1`] = `[]`;
-exports[`'sources' option should work and override the "img" tag logic with "...": errors 1`] = `[]`;
+exports[`'sources' option should work by default: errors 1`] = `[]`;
-exports[`'sources' option should work and override the "img" tag logic with "...": module 1`] = `
+exports[`'sources' option should work by default: module 1`] = `
"// Imports
import ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___ from "../../src/runtime/getUrl.js";
-var ___HTML_LOADER_IMPORT_0___ = new URL("./script.file.js", import.meta.url);
-var ___HTML_LOADER_IMPORT_1___ = new URL("./image.png", import.meta.url);
-var ___HTML_LOADER_IMPORT_2___ = new URL("./image.png?foo=bar,baz", import.meta.url);
-var ___HTML_LOADER_IMPORT_3___ = new URL("./image.png?bar=baz,foo", import.meta.url);
-var ___HTML_LOADER_IMPORT_4___ = new URL("./example.ogg", import.meta.url);
-var ___HTML_LOADER_IMPORT_5___ = new URL("./example.pdf", import.meta.url);
-var ___HTML_LOADER_IMPORT_6___ = new URL("./example.vtt", import.meta.url);
-var ___HTML_LOADER_IMPORT_7___ = new URL("./style.file.css", import.meta.url);
-var ___HTML_LOADER_IMPORT_8___ = new URL("./module.file.js", import.meta.url);
-var ___HTML_LOADER_IMPORT_9___ = new URL("./fallback.file.js", import.meta.url);
-var ___HTML_LOADER_IMPORT_10___ = new URL("./image image.png", import.meta.url);
-var ___HTML_LOADER_IMPORT_11___ = new URL("aliasImageWithSpace", import.meta.url);
-var ___HTML_LOADER_IMPORT_12___ = new URL("./webpack.svg", import.meta.url);
-var ___HTML_LOADER_IMPORT_13___ = new URL("./site.webmanifest", import.meta.url);
-var ___HTML_LOADER_IMPORT_14___ = new URL("./browserconfig.xml", import.meta.url);
-var ___HTML_LOADER_IMPORT_15___ = new URL("./favicon.ico", import.meta.url);
-var ___HTML_LOADER_IMPORT_16___ = new URL("./sound.mp3", import.meta.url);
-var ___HTML_LOADER_IMPORT_17___ = new URL("./video.mp4", import.meta.url);
+var ___HTML_LOADER_IMPORT_0___ = new URL("./image.png", import.meta.url);
+var ___HTML_LOADER_IMPORT_1___ = new URL("/image.png", import.meta.url);
+var ___HTML_LOADER_IMPORT_2___ = new URL("aliasImg", import.meta.url);
+var ___HTML_LOADER_IMPORT_3___ = new URL("./script.file.js", import.meta.url);
+var ___HTML_LOADER_IMPORT_4___ = new URL("./icons.svg", import.meta.url);
+var ___HTML_LOADER_IMPORT_5___ = new URL("./image.png?foo=bar,baz", import.meta.url);
+var ___HTML_LOADER_IMPORT_6___ = new URL("./image.png?bar=baz,foo", import.meta.url);
+var ___HTML_LOADER_IMPORT_7___ = new URL("./example.ogg", import.meta.url);
+var ___HTML_LOADER_IMPORT_8___ = new URL("./example.pdf", import.meta.url);
+var ___HTML_LOADER_IMPORT_9___ = new URL("./example.vtt", import.meta.url);
+var ___HTML_LOADER_IMPORT_10___ = new URL("./style.file.css", import.meta.url);
+var ___HTML_LOADER_IMPORT_11___ = new URL("data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==", import.meta.url);
+var ___HTML_LOADER_IMPORT_12___ = new URL("./image image.png", import.meta.url);
+var ___HTML_LOADER_IMPORT_13___ = new URL("./module.file.js", import.meta.url);
+var ___HTML_LOADER_IMPORT_14___ = new URL("./fallback.file.js", import.meta.url);
+var ___HTML_LOADER_IMPORT_15___ = new URL("aliasImageWithSpace", import.meta.url);
+var ___HTML_LOADER_IMPORT_16___ = new URL("./webpack.svg", import.meta.url);
+var ___HTML_LOADER_IMPORT_17___ = new URL("./pixel.png?url", import.meta.url);
+var ___HTML_LOADER_IMPORT_18___ = new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==", import.meta.url);
+var ___HTML_LOADER_IMPORT_19___ = new URL("./site.webmanifest", import.meta.url);
+var ___HTML_LOADER_IMPORT_20___ = new URL("./browserconfig.xml", import.meta.url);
+var ___HTML_LOADER_IMPORT_21___ = new URL("./favicon.ico", import.meta.url);
+var ___HTML_LOADER_IMPORT_22___ = new URL("./sound.mp3", import.meta.url);
+var ___HTML_LOADER_IMPORT_23___ = new URL("./video.mp4", import.meta.url);
+var ___HTML_LOADER_IMPORT_24___ = new URL("./nested/image3.png", import.meta.url);
+var ___HTML_LOADER_IMPORT_25___ = new URL("/nested/image3.png", import.meta.url);
+var ___HTML_LOADER_IMPORT_26___ = new URL("./noscript.png", import.meta.url);
// Module
var ___HTML_LOADER_REPLACEMENT_0___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___);
-var ___HTML_LOADER_REPLACEMENT_1___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_1___);
-var ___HTML_LOADER_REPLACEMENT_2___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_2___);
-var ___HTML_LOADER_REPLACEMENT_3___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_3___);
-var ___HTML_LOADER_REPLACEMENT_4___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_4___);
-var ___HTML_LOADER_REPLACEMENT_5___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_5___);
-var ___HTML_LOADER_REPLACEMENT_6___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_6___);
-var ___HTML_LOADER_REPLACEMENT_7___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_7___);
-var ___HTML_LOADER_REPLACEMENT_8___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_8___);
-var ___HTML_LOADER_REPLACEMENT_9___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_9___);
-var ___HTML_LOADER_REPLACEMENT_10___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_1___, { maybeNeedQuotes: true });
+var ___HTML_LOADER_REPLACEMENT_1___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { maybeNeedQuotes: true });
+var ___HTML_LOADER_REPLACEMENT_2___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_1___);
+var ___HTML_LOADER_REPLACEMENT_3___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_2___);
+var ___HTML_LOADER_REPLACEMENT_4___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_3___);
+var ___HTML_LOADER_REPLACEMENT_5___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_4___, { hash: "#icon-chevron-with-circle-up" });
+var ___HTML_LOADER_REPLACEMENT_6___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_5___);
+var ___HTML_LOADER_REPLACEMENT_7___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_6___);
+var ___HTML_LOADER_REPLACEMENT_8___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_7___);
+var ___HTML_LOADER_REPLACEMENT_9___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_8___);
+var ___HTML_LOADER_REPLACEMENT_10___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_9___);
var ___HTML_LOADER_REPLACEMENT_11___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_10___);
-var ___HTML_LOADER_REPLACEMENT_12___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_11___, { maybeNeedQuotes: true });
-var ___HTML_LOADER_REPLACEMENT_13___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_11___);
-var ___HTML_LOADER_REPLACEMENT_14___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_1___, { hash: "#hash" });
-var ___HTML_LOADER_REPLACEMENT_15___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_1___, { hash: "#foo" });
-var ___HTML_LOADER_REPLACEMENT_16___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_1___, { hash: "#bar" });
-var ___HTML_LOADER_REPLACEMENT_17___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_12___);
-var ___HTML_LOADER_REPLACEMENT_18___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_13___);
-var ___HTML_LOADER_REPLACEMENT_19___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_14___);
-var ___HTML_LOADER_REPLACEMENT_20___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_15___);
-var ___HTML_LOADER_REPLACEMENT_21___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_16___);
-var ___HTML_LOADER_REPLACEMENT_22___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_17___);
-var code = "\\n\\n
My First Heading
\\n
My first paragraph.
\\n
An Unordered HTML List
\\n\\n
\\n - Coffee
\\n - Tea
\\n - Milk
\\n
\\n\\n
An Ordered HTML List
\\n\\n
\\n - Coffee
\\n - Tea
\\n - Milk
\\n
\\n\\n<" + "script>console.log({\\"json\\": \\"with \\\\\\"quotes\\\\\\" in value\\"})<" + "/script>\\n\\n\\n\\n
Foo
\\n\\n\\n
BAR
\\n\\n
\\n\\n<" + "script> console.log(1 + 2 + \`\${3 + 3}\`) <" + "/script>\\n\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n\\n<" + "script src=\\"" + ___HTML_LOADER_REPLACEMENT_0___ + "\\"><" + "/script>\\n\\n
\\n
\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n<" + "script src=\\"https://github.com/webpack-contrib/css-loader/blob/master/src/index.js\\"><" + "/script>\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nT ex t \\n\\n\\n\\n]]>\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nlink text\\n\\nCall me\\n\\n-->\\n-->\\n\\n\\n\\n\\n\\n
\\n
\\n\\n<div id = "character">\\n© 2007\\nor\\n© 2007\\n\\n
\\n\\n\\n\\n Written by Jon Doe.
\\n Visit us at:
\\n Example.com
\\n Box 564, Disneyland
\\n USA\\n\\nlink\\nStart Chat\\nStart Chat\\nStart Chat\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n Test \\n\\ntest\\ntest\\ntest\\n\\n\\n\\n\\n\\nText
\\nText
\\nText
\\n\\n\\n\\n<" + "script type=\\"module\\" src=\\"" + ___HTML_LOADER_REPLACEMENT_8___ + "\\"><" + "/script>\\n<" + "script nomodule src=\\"" + ___HTML_LOADER_REPLACEMENT_9___ + "\\"><" + "/script>\\n<" + "script type=\\"text/javascript\\" src=\\"" + ___HTML_LOADER_REPLACEMENT_9___ + "\\"><" + "/script>\\n<" + "script type=\\"application/javascript\\" src=\\"" + ___HTML_LOADER_REPLACEMENT_9___ + "\\"><" + "/script>\\n<" + "script type=\\"application/json\\" src=\\"fallback.file.json\\"><" + "/script>\\n<" + "script type=\\"text/x-handlebars-template\\" src=\\"preprocessor.hbs\\"><" + "/script>\\n<" + "script type=\\"module\\">\\n function test() {}\\n<" + "/script>\\n<" + "script>\\n function test() {}\\n<" + "/script>\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfoo bar\\n\\nText\\nText\\n\\n\\n\\n
\\n\\nVisit our HTML tutorial\\nVisit our HTML tutorial\\n\\n<" + "script type=\\"text/javascript\\">\\n console.log('HERE')\\n<" + "/script>\\n\\n\\n\\ntext
\\ntext
\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\" alt=\\"<%= name %>\\" src=\\"<%= imgsrc %>\\" />\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n";
-// Exports
-export default code;"
-`;
-
-exports[`'sources' option should work and override the "img" tag logic with "...": result 1`] = `
-"
+var ___HTML_LOADER_REPLACEMENT_12___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_11___);
+var ___HTML_LOADER_REPLACEMENT_13___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_12___);
+var ___HTML_LOADER_REPLACEMENT_14___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_13___);
+var ___HTML_LOADER_REPLACEMENT_15___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_14___);
+var ___HTML_LOADER_REPLACEMENT_16___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_15___, { maybeNeedQuotes: true });
+var ___HTML_LOADER_REPLACEMENT_17___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_15___);
+var ___HTML_LOADER_REPLACEMENT_18___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#hash" });
+var ___HTML_LOADER_REPLACEMENT_19___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#hash", maybeNeedQuotes: true });
+var ___HTML_LOADER_REPLACEMENT_20___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#", maybeNeedQuotes: true });
+var ___HTML_LOADER_REPLACEMENT_21___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#foo" });
+var ___HTML_LOADER_REPLACEMENT_22___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#bar" });
+var ___HTML_LOADER_REPLACEMENT_23___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#baz" });
+var ___HTML_LOADER_REPLACEMENT_24___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_15___, { hash: "#hash", maybeNeedQuotes: true });
+var ___HTML_LOADER_REPLACEMENT_25___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_16___);
+var ___HTML_LOADER_REPLACEMENT_26___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_17___);
+var ___HTML_LOADER_REPLACEMENT_27___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_18___);
+var ___HTML_LOADER_REPLACEMENT_28___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_19___);
+var ___HTML_LOADER_REPLACEMENT_29___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_20___);
+var ___HTML_LOADER_REPLACEMENT_30___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_21___);
+var ___HTML_LOADER_REPLACEMENT_31___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_22___);
+var ___HTML_LOADER_REPLACEMENT_32___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_23___);
+var ___HTML_LOADER_REPLACEMENT_33___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_24___);
+var ___HTML_LOADER_REPLACEMENT_34___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_25___);
+var ___HTML_LOADER_REPLACEMENT_35___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_26___);
+var code = \`
My First Heading
My first paragraph.
@@ -3957,7 +11915,7 @@ exports[`'sources' option should work and override the "img" tag logic with "...
Milk
-
+\${"<" + "script"}>console.log({"json": "with \\\\"quotes\\\\" in value"})\${"<" + "/script"}>
@@ -3968,136 +11926,136 @@ exports[`'sources' option should work and override the "img" tag logic with "...
-
-
-
-
-
-
-
-
-
-
-
-
+\${"<" + "script"}> console.log(1 + 2 + \\\`\\\${3 + 3}\\\`) \${"<" + "/script"}>
+
+
+
+
+
+
+
+
+
+
+
-
+\${"<" + "script"} src="\${___HTML_LOADER_REPLACEMENT_4___}">\${"<" + "/script"}>
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+" src="\${___HTML_LOADER_REPLACEMENT_0___}" alt="Elva dressed as a fairy">
-
"
`;
-exports[`'sources' option should work by default: warnings 1`] = `[]`;
+exports[`'sources' option should work with "..." syntax: warnings 1`] = `[]`;
-exports[`'sources' option should work prefer source with tag over without: errors 1`] = `[]`;
+exports[`'sources' option should work with an "object" notations: errors 1`] = `[]`;
-exports[`'sources' option should work prefer source with tag over without: module 1`] = `
+exports[`'sources' option should work with an "object" notations: module 1`] = `
"// Imports
import ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___ from "../../src/runtime/getUrl.js";
-var ___HTML_LOADER_IMPORT_0___ = new URL("./script.file.js", import.meta.url);
-var ___HTML_LOADER_IMPORT_1___ = new URL("./example.ogg", import.meta.url);
-var ___HTML_LOADER_IMPORT_2___ = new URL("./example.pdf", import.meta.url);
-var ___HTML_LOADER_IMPORT_3___ = new URL("./template.html", import.meta.url);
-var ___HTML_LOADER_IMPORT_4___ = new URL("./image.png", import.meta.url);
-var ___HTML_LOADER_IMPORT_5___ = new URL("./example.vtt", import.meta.url);
-var ___HTML_LOADER_IMPORT_6___ = new URL("./module.file.js", import.meta.url);
-var ___HTML_LOADER_IMPORT_7___ = new URL("./fallback.file.js", import.meta.url);
-var ___HTML_LOADER_IMPORT_8___ = new URL("./fallback.file.json", import.meta.url);
-var ___HTML_LOADER_IMPORT_9___ = new URL("./preprocessor.hbs", import.meta.url);
+var ___HTML_LOADER_IMPORT_0___ = new URL("./image.png", import.meta.url);
+var ___HTML_LOADER_IMPORT_1___ = new URL("/image.png", import.meta.url);
+var ___HTML_LOADER_IMPORT_2___ = new URL("aliasImg", import.meta.url);
+var ___HTML_LOADER_IMPORT_3___ = new URL("./icons.svg", import.meta.url);
+var ___HTML_LOADER_IMPORT_4___ = new URL("data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==", import.meta.url);
+var ___HTML_LOADER_IMPORT_5___ = new URL("./image image.png", import.meta.url);
+var ___HTML_LOADER_IMPORT_6___ = new URL("aliasImageWithSpace", import.meta.url);
+var ___HTML_LOADER_IMPORT_7___ = new URL("./pixel.png?url", import.meta.url);
+var ___HTML_LOADER_IMPORT_8___ = new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==", import.meta.url);
+var ___HTML_LOADER_IMPORT_9___ = new URL("./nested/image3.png", import.meta.url);
+var ___HTML_LOADER_IMPORT_10___ = new URL("/nested/image3.png", import.meta.url);
+var ___HTML_LOADER_IMPORT_11___ = new URL("./noscript.png", import.meta.url);
// Module
var ___HTML_LOADER_REPLACEMENT_0___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___);
-var ___HTML_LOADER_REPLACEMENT_1___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_1___);
-var ___HTML_LOADER_REPLACEMENT_2___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_2___);
-var ___HTML_LOADER_REPLACEMENT_3___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_3___);
-var ___HTML_LOADER_REPLACEMENT_4___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_4___);
-var ___HTML_LOADER_REPLACEMENT_5___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_5___);
-var ___HTML_LOADER_REPLACEMENT_6___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_6___);
-var ___HTML_LOADER_REPLACEMENT_7___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_7___);
-var ___HTML_LOADER_REPLACEMENT_8___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_8___);
-var ___HTML_LOADER_REPLACEMENT_9___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_9___);
-var code = "\\n\\n
My First Heading
\\n
My first paragraph.
\\n
An Unordered HTML List
\\n\\n
\\n - Coffee
\\n - Tea
\\n - Milk
\\n
\\n\\n
An Ordered HTML List
\\n\\n
\\n - Coffee
\\n - Tea
\\n - Milk
\\n
\\n\\n<" + "script>console.log({\\"json\\": \\"with \\\\\\"quotes\\\\\\" in value\\"})<" + "/script>\\n\\n\\n\\n
Foo
\\n\\n\\n
BAR
\\n\\n
\\n\\n<" + "script> console.log(1 + 2 + \`\${3 + 3}\`) <" + "/script>\\n\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n\\n<" + "script src=\\"" + ___HTML_LOADER_REPLACEMENT_0___ + "\\"><" + "/script>\\n\\n
\\n
\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n Your browser does not support the audio element.\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n<" + "script src=\\"https://github.com/webpack-contrib/css-loader/blob/master/src/index.js\\"><" + "/script>\\n\\n\\n \\n\\n\\n\\n\\n\\n\\n\\n\\n\\nT ex t \\n\\n\\n\\n]]>\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nlink text\\n\\nCall me\\n\\n-->\\n-->\\n\\n\\n\\n\\n\\n
\\n
\\n\\n<div id = "character">\\n© 2007\\nor\\n© 2007\\n\\n
\\n\\n\\n\\n Written by Jon Doe.
\\n Visit us at:
\\n Example.com
\\n Box 564, Disneyland
\\n USA\\n\\nlink\\nStart Chat\\nStart Chat\\nStart Chat\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n Test \\n\\ntest\\ntest\\ntest\\n\\n\\n\\n\\n\\nText
\\nText
\\nText
\\n\\n\\n\\n<" + "script type=\\"module\\" src=\\"" + ___HTML_LOADER_REPLACEMENT_6___ + "\\"><" + "/script>\\n<" + "script nomodule src=\\"" + ___HTML_LOADER_REPLACEMENT_7___ + "\\"><" + "/script>\\n<" + "script type=\\"text/javascript\\" src=\\"" + ___HTML_LOADER_REPLACEMENT_7___ + "\\"><" + "/script>\\n<" + "script type=\\"application/javascript\\" src=\\"" + ___HTML_LOADER_REPLACEMENT_7___ + "\\"><" + "/script>\\n<" + "script type=\\"application/json\\" src=\\"" + ___HTML_LOADER_REPLACEMENT_8___ + "\\"><" + "/script>\\n<" + "script type=\\"text/x-handlebars-template\\" src=\\"" + ___HTML_LOADER_REPLACEMENT_9___ + "\\"><" + "/script>\\n<" + "script type=\\"module\\">\\n function test() {}\\n<" + "/script>\\n<" + "script>\\n function test() {}\\n<" + "/script>\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfoo bar\\n\\nText\\nText\\n\\n\\n\\n
\\n\\nVisit our HTML tutorial\\nVisit our HTML tutorial\\n\\n<" + "script type=\\"text/javascript\\">\\n console.log('HERE')\\n<" + "/script>\\n\\n\\n\\ntext
\\ntext
\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\" alt=\\"<%= name %>\\" src=\\"<%= imgsrc %>\\" />\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n";
-// Exports
-export default code;"
-`;
-
-exports[`'sources' option should work prefer source with tag over without: result 1`] = `
-"
+var ___HTML_LOADER_REPLACEMENT_1___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { maybeNeedQuotes: true });
+var ___HTML_LOADER_REPLACEMENT_2___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_1___);
+var ___HTML_LOADER_REPLACEMENT_3___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_2___);
+var ___HTML_LOADER_REPLACEMENT_4___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_3___, { hash: "#icon-chevron-with-circle-up" });
+var ___HTML_LOADER_REPLACEMENT_5___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_4___);
+var ___HTML_LOADER_REPLACEMENT_6___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_5___);
+var ___HTML_LOADER_REPLACEMENT_7___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_6___, { maybeNeedQuotes: true });
+var ___HTML_LOADER_REPLACEMENT_8___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_6___);
+var ___HTML_LOADER_REPLACEMENT_9___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#hash" });
+var ___HTML_LOADER_REPLACEMENT_10___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#hash", maybeNeedQuotes: true });
+var ___HTML_LOADER_REPLACEMENT_11___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#", maybeNeedQuotes: true });
+var ___HTML_LOADER_REPLACEMENT_12___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#baz" });
+var ___HTML_LOADER_REPLACEMENT_13___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_6___, { hash: "#hash", maybeNeedQuotes: true });
+var ___HTML_LOADER_REPLACEMENT_14___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_7___);
+var ___HTML_LOADER_REPLACEMENT_15___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_8___);
+var ___HTML_LOADER_REPLACEMENT_16___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_9___);
+var ___HTML_LOADER_REPLACEMENT_17___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_10___);
+var ___HTML_LOADER_REPLACEMENT_18___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_11___);
+var code = \`
My First Heading
My first paragraph.
@@ -7113,7 +14786,7 @@ exports[`'sources' option should work prefer source with tag over without: resul
Milk
-
+\${"<" + "script"}>console.log({"json": "with \\\\"quotes\\\\" in value"})\${"<" + "/script"}>
@@ -7124,44 +14797,44 @@ exports[`'sources' option should work prefer source with tag over without: resul
-
-
-
-
-
-
-
-
-
-
-
-
+\${"<" + "script"}> console.log(1 + 2 + \\\`\\\${3 + 3}\\\`) \${"<" + "/script"}>
+
+
+
+
+
+
+
+
+
+
+
-
+\${"<" + "script"} src="./script.file.js">\${"<" + "/script"}>
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+ src="\${___HTML_LOADER_REPLACEMENT_0___}" alt="Elva dressed as a fairy">
+
+
+
+
+" src="\${___HTML_LOADER_REPLACEMENT_0___}" alt="Elva dressed as a fairy">
-
+
Your browser does not support the audio element.
-
+
-
+
-
+
-
+\${"<" + "script"} src="https://github.com/webpack-contrib/css-loader/blob/master/src/index.js">\${"<" + "/script"}>
-
-
"
`;
-exports[`'sources' option should work with "..." syntax: warnings 1`] = `[]`;
+exports[`'sources' option should work with an "object" notations: warnings 1`] = `[]`;
-exports[`'sources' option should work with an "object" notations: errors 1`] = `[]`;
+exports[`'sources' option should work with an empty "object" notations: errors 1`] = `[]`;
-exports[`'sources' option should work with an "object" notations: module 1`] = `
+exports[`'sources' option should work with an empty "object" notations: module 1`] = `
"// Imports
import ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___ from "../../src/runtime/getUrl.js";
var ___HTML_LOADER_IMPORT_0___ = new URL("./image.png", import.meta.url);
var ___HTML_LOADER_IMPORT_1___ = new URL("/image.png", import.meta.url);
var ___HTML_LOADER_IMPORT_2___ = new URL("aliasImg", import.meta.url);
-var ___HTML_LOADER_IMPORT_3___ = new URL("./icons.svg", import.meta.url);
-var ___HTML_LOADER_IMPORT_4___ = new URL("data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==", import.meta.url);
-var ___HTML_LOADER_IMPORT_5___ = new URL("./image image.png", import.meta.url);
-var ___HTML_LOADER_IMPORT_6___ = new URL("aliasImageWithSpace", import.meta.url);
-var ___HTML_LOADER_IMPORT_7___ = new URL("./pixel.png?url", import.meta.url);
-var ___HTML_LOADER_IMPORT_8___ = new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==", import.meta.url);
-var ___HTML_LOADER_IMPORT_9___ = new URL("./nested/image3.png", import.meta.url);
-var ___HTML_LOADER_IMPORT_10___ = new URL("/nested/image3.png", import.meta.url);
-var ___HTML_LOADER_IMPORT_11___ = new URL("./noscript.png", import.meta.url);
+var ___HTML_LOADER_IMPORT_3___ = new URL("./script.file.js", import.meta.url);
+var ___HTML_LOADER_IMPORT_4___ = new URL("./icons.svg", import.meta.url);
+var ___HTML_LOADER_IMPORT_5___ = new URL("./image.png?foo=bar,baz", import.meta.url);
+var ___HTML_LOADER_IMPORT_6___ = new URL("./image.png?bar=baz,foo", import.meta.url);
+var ___HTML_LOADER_IMPORT_7___ = new URL("./example.ogg", import.meta.url);
+var ___HTML_LOADER_IMPORT_8___ = new URL("./example.pdf", import.meta.url);
+var ___HTML_LOADER_IMPORT_9___ = new URL("./example.vtt", import.meta.url);
+var ___HTML_LOADER_IMPORT_10___ = new URL("./style.file.css", import.meta.url);
+var ___HTML_LOADER_IMPORT_11___ = new URL("data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==", import.meta.url);
+var ___HTML_LOADER_IMPORT_12___ = new URL("./image image.png", import.meta.url);
+var ___HTML_LOADER_IMPORT_13___ = new URL("./module.file.js", import.meta.url);
+var ___HTML_LOADER_IMPORT_14___ = new URL("./fallback.file.js", import.meta.url);
+var ___HTML_LOADER_IMPORT_15___ = new URL("aliasImageWithSpace", import.meta.url);
+var ___HTML_LOADER_IMPORT_16___ = new URL("./webpack.svg", import.meta.url);
+var ___HTML_LOADER_IMPORT_17___ = new URL("./pixel.png?url", import.meta.url);
+var ___HTML_LOADER_IMPORT_18___ = new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==", import.meta.url);
+var ___HTML_LOADER_IMPORT_19___ = new URL("./site.webmanifest", import.meta.url);
+var ___HTML_LOADER_IMPORT_20___ = new URL("./browserconfig.xml", import.meta.url);
+var ___HTML_LOADER_IMPORT_21___ = new URL("./favicon.ico", import.meta.url);
+var ___HTML_LOADER_IMPORT_22___ = new URL("./sound.mp3", import.meta.url);
+var ___HTML_LOADER_IMPORT_23___ = new URL("./video.mp4", import.meta.url);
+var ___HTML_LOADER_IMPORT_24___ = new URL("./nested/image3.png", import.meta.url);
+var ___HTML_LOADER_IMPORT_25___ = new URL("/nested/image3.png", import.meta.url);
// Module
var ___HTML_LOADER_REPLACEMENT_0___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___);
var ___HTML_LOADER_REPLACEMENT_1___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { maybeNeedQuotes: true });
var ___HTML_LOADER_REPLACEMENT_2___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_1___);
var ___HTML_LOADER_REPLACEMENT_3___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_2___);
-var ___HTML_LOADER_REPLACEMENT_4___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_3___, { hash: "#icon-chevron-with-circle-up" });
-var ___HTML_LOADER_REPLACEMENT_5___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_4___);
+var ___HTML_LOADER_REPLACEMENT_4___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_3___);
+var ___HTML_LOADER_REPLACEMENT_5___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_4___, { hash: "#icon-chevron-with-circle-up" });
var ___HTML_LOADER_REPLACEMENT_6___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_5___);
-var ___HTML_LOADER_REPLACEMENT_7___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_6___, { maybeNeedQuotes: true });
-var ___HTML_LOADER_REPLACEMENT_8___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_6___);
-var ___HTML_LOADER_REPLACEMENT_9___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#hash" });
-var ___HTML_LOADER_REPLACEMENT_10___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#hash", maybeNeedQuotes: true });
-var ___HTML_LOADER_REPLACEMENT_11___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#", maybeNeedQuotes: true });
-var ___HTML_LOADER_REPLACEMENT_12___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#baz" });
-var ___HTML_LOADER_REPLACEMENT_13___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_6___, { hash: "#hash", maybeNeedQuotes: true });
-var ___HTML_LOADER_REPLACEMENT_14___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_7___);
-var ___HTML_LOADER_REPLACEMENT_15___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_8___);
-var ___HTML_LOADER_REPLACEMENT_16___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_9___);
-var ___HTML_LOADER_REPLACEMENT_17___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_10___);
-var ___HTML_LOADER_REPLACEMENT_18___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_11___);
-var code = "\\n\\n
My First Heading
\\n
My first paragraph.
\\n
An Unordered HTML List
\\n\\n
\\n - Coffee
\\n - Tea
\\n - Milk
\\n
\\n\\n
An Ordered HTML List
\\n\\n
\\n - Coffee
\\n - Tea
\\n - Milk
\\n
\\n\\n<" + "script>console.log({\\"json\\": \\"with \\\\\\"quotes\\\\\\" in value\\"})<" + "/script>\\n\\n\\n\\n
Foo
\\n\\n\\n
BAR
\\n\\n
\\n\\n<" + "script> console.log(1 + 2 + \`\${3 + 3}\`) <" + "/script>\\n\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n\\n<" + "script src=\\"./script.file.js\\"><" + "/script>\\n\\n
\\n
\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n Your browser does not support the audio element.\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n<" + "script src=\\"https://github.com/webpack-contrib/css-loader/blob/master/src/index.js\\"><" + "/script>\\n\\n\\n \\n Your browser does not support the audio element.\\n\\n\\n\\n \\n \\n\\n\\n Your browser does not support the video tag.\\n\\n\\n\\n \\n \\n\\n\\n\\nT ex t \\n\\n\\n\\n]]>\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nlink text\\n\\nCall me\\n\\n-->\\n-->\\n\\n\\n\\n\\n\\n
\\n
\\n\\n<div id = "character">\\n© 2007\\nor\\n© 2007\\n\\n
\\n\\n\\n\\n Written by Jon Doe.
\\n Visit us at:
\\n Example.com
\\n Box 564, Disneyland
\\n USA\\n\\nlink\\nStart Chat\\nStart Chat\\nStart Chat\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n Test \\n\\ntest\\ntest\\ntest\\n\\n\\n\\n\\n\\nText
\\nText
\\nText
\\n\\n\\n\\n<" + "script type=\\"module\\" src=\\"module.file.js\\"><" + "/script>\\n<" + "script nomodule src=\\"fallback.file.js\\"><" + "/script>\\n<" + "script type=\\"text/javascript\\" src=\\"fallback.file.js\\"><" + "/script>\\n<" + "script type=\\"application/javascript\\" src=\\"fallback.file.js\\"><" + "/script>\\n<" + "script type=\\"application/json\\" src=\\"fallback.file.json\\"><" + "/script>\\n<" + "script type=\\"text/x-handlebars-template\\" src=\\"preprocessor.hbs\\"><" + "/script>\\n<" + "script type=\\"module\\">\\n function test() {}\\n<" + "/script>\\n<" + "script>\\n function test() {}\\n<" + "/script>\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n \\n\\n\\n\\n \\n\\n\\n\\n \\n\\n\\n\\n \\n\\n\\nfoo bar\\n\\nText\\nText\\n\\n\\n\\n
\\n\\nVisit our HTML tutorial\\nVisit our HTML tutorial\\n\\n<" + "script type=\\"text/javascript\\">\\n console.log('HERE')\\n<" + "/script>\\n\\n\\n\\ntext
\\ntext
\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\" alt=\\"<%= name %>\\" src=\\"<%= imgsrc %>\\" />\\n\\n\\n <" + "script href=\\"./script.file.js\\"><" + "/script>\\n\\n\\n <" + "script type=\\"application/json\\" href=\\"./script.file.js\\"><" + "/script>\\n\\n\\n <" + "script xlink:href=\\"./script.file.js\\"><" + "/script>\\n\\n\\n <" + "script type=\\"application/json\\" xlink:href=\\"./script.file.js\\"><" + "/script>\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n";
-// Exports
-export default code;"
-`;
-
-exports[`'sources' option should work with an "object" notations: result 1`] = `
-"
+var ___HTML_LOADER_REPLACEMENT_7___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_6___);
+var ___HTML_LOADER_REPLACEMENT_8___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_7___);
+var ___HTML_LOADER_REPLACEMENT_9___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_8___);
+var ___HTML_LOADER_REPLACEMENT_10___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_9___);
+var ___HTML_LOADER_REPLACEMENT_11___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_10___);
+var ___HTML_LOADER_REPLACEMENT_12___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_11___);
+var ___HTML_LOADER_REPLACEMENT_13___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_12___);
+var ___HTML_LOADER_REPLACEMENT_14___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_13___);
+var ___HTML_LOADER_REPLACEMENT_15___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_14___);
+var ___HTML_LOADER_REPLACEMENT_16___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_15___, { maybeNeedQuotes: true });
+var ___HTML_LOADER_REPLACEMENT_17___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_15___);
+var ___HTML_LOADER_REPLACEMENT_18___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#hash" });
+var ___HTML_LOADER_REPLACEMENT_19___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#hash", maybeNeedQuotes: true });
+var ___HTML_LOADER_REPLACEMENT_20___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#", maybeNeedQuotes: true });
+var ___HTML_LOADER_REPLACEMENT_21___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#foo" });
+var ___HTML_LOADER_REPLACEMENT_22___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#bar" });
+var ___HTML_LOADER_REPLACEMENT_23___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_0___, { hash: "#baz" });
+var ___HTML_LOADER_REPLACEMENT_24___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_15___, { hash: "#hash", maybeNeedQuotes: true });
+var ___HTML_LOADER_REPLACEMENT_25___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_16___);
+var ___HTML_LOADER_REPLACEMENT_26___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_17___);
+var ___HTML_LOADER_REPLACEMENT_27___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_18___);
+var ___HTML_LOADER_REPLACEMENT_28___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_19___);
+var ___HTML_LOADER_REPLACEMENT_29___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_20___);
+var ___HTML_LOADER_REPLACEMENT_30___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_21___);
+var ___HTML_LOADER_REPLACEMENT_31___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_22___);
+var ___HTML_LOADER_REPLACEMENT_32___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_23___);
+var ___HTML_LOADER_REPLACEMENT_33___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_24___);
+var ___HTML_LOADER_REPLACEMENT_34___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_25___);
+var code = \`
My First Heading
My first paragraph.
@@ -8144,7 +15762,7 @@ exports[`'sources' option should work with an "object" notations: result 1`] = `
Milk
-
+\${"<" + "script"}>console.log({"json": "with \\\\"quotes\\\\" in value"})\${"<" + "/script"}>
@@ -8152,139 +15770,139 @@ exports[`'sources' option should work with an "object" notations: result 1`] = `
BAR
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+\${"<" + "script"}> console.log(1 + 2 + \\\`\\\${3 + 3}\\\`) \${"<" + "/script"}>
+
+
+
+
+
+
+
+
+
+
+
+
+
+\${"<" + "script"} src="\${___HTML_LOADER_REPLACEMENT_4___}">\${"<" + "/script"}>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+" src="\${___HTML_LOADER_REPLACEMENT_0___}" alt="Elva dressed as a fairy">
-
+
Your browser does not support the audio element.
-
+
-
+
-
+\${"<" + "script"} src="https://github.com/webpack-contrib/css-loader/blob/master/src/index.js">\${"<" + "/script"}>
-
+
Your browser does not support the audio element.
-
-
-
+
Your browser does not support the video tag.
-
-
-
+
+
+
-
+
-T ex t
-]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
link text
Call me
--->
--->
+-->
+-->
@@ -8302,7 +15920,7 @@ or
-
+
Written by Jon Doe.
Visit us at:
@@ -8315,72 +15933,72 @@ or
Start Chat
Start Chat
-
+
-
+
-
+
-
-
- Test
-
-test
-test
-test
-
+
+
+ Test
+
+test
+test
+test
+
-
-
+
+
Text
Text
Text
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+\${"<" + "/script"}>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
@@ -8395,29 +16013,29 @@ replaced_file_protocol_/webpack/public/path/image.png
-
+
-
+
-
+
-
+
-
+
-
+
foo bar
@@ -8432,9 +16050,9 @@ replaced_file_protocol_/webpack/public/path/image.png
Visit our HTML tutorial
Visit our HTML tutorial
-
+\${"<" + "/script"}>
\\n\\ntext
\\ntext
\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\" alt=\\"<%= name %>\\" src=\\"<%= imgsrc %>\\" />\\n\\n\\n <" + "script href=\\"" + ___HTML_LOADER_REPLACEMENT_4___ + "\\"><" + "/script>\\n\\n\\n <" + "script type=\\"application/json\\" href=\\"./script.file.js\\"><" + "/script>\\n\\n\\n <" + "script xlink:href=\\"" + ___HTML_LOADER_REPLACEMENT_4___ + "\\"><" + "/script>\\n\\n\\n <" + "script type=\\"application/json\\" xlink:href=\\"./script.file.js\\"><" + "/script>\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n";
+\`;
// Exports
export default code;"
`;
diff --git a/test/postprocessor-option.test.js b/test/postprocessor-option.test.js
index e73f4ea8..7865d95a 100644
--- a/test/postprocessor-option.test.js
+++ b/test/postprocessor-option.test.js
@@ -1,3 +1,5 @@
+import path from "path";
+
import {
compile,
execute,
@@ -15,7 +17,11 @@ describe("'postprocess' option", () => {
expect(typeof content).toBe("string");
expect(loaderContext).toBeDefined();
- return content.replace(/<%=/g, '" +').replace(/%>/g, '+ "');
+ const isTemplateLiteralSupported = content[0] === "`";
+
+ return content
+ .replace(/<%=/g, isTemplateLiteralSupported ? `\${` : '" +')
+ .replace(/%>/g, isTemplateLiteralSupported ? "}" : '+ "');
},
});
const stats = await compile(compiler);
@@ -30,13 +36,58 @@ describe("'postprocess' option", () => {
expect(getErrors(stats)).toMatchSnapshot("errors");
});
+ it('should work with the "postprocessor" option #1', async () => {
+ const compiler = getCompiler(
+ "postprocessor.html",
+ {
+ postprocessor: (content, loaderContext) => {
+ expect(typeof content).toBe("string");
+ expect(loaderContext).toBeDefined();
+
+ const isTemplateLiteralSupported = content[0] === "`";
+
+ return content
+ .replace(/<%=/g, isTemplateLiteralSupported ? `\${` : '" +')
+ .replace(/%>/g, isTemplateLiteralSupported ? "}" : '+ "');
+ },
+ },
+ {
+ output: {
+ path: path.resolve(__dirname, "./outputs"),
+ filename: "[name].bundle.js",
+ chunkFilename: "[name].chunk.js",
+ chunkLoading: "require",
+ publicPath: "/webpack/public/path/",
+ library: "___TEST___",
+ assetModuleFilename: "[name][ext]",
+ hashFunction: "xxhash64",
+ environment: { templateLiteral: false },
+ },
+ },
+ );
+ const stats = await compile(compiler);
+
+ expect(getModuleSource("./postprocessor.html", stats)).toMatchSnapshot(
+ "module",
+ );
+ expect(
+ execute(readAsset("main.bundle.js", compiler, stats)),
+ ).toMatchSnapshot("result");
+ expect(getWarnings(stats)).toMatchSnapshot("warnings");
+ expect(getErrors(stats)).toMatchSnapshot("errors");
+ });
+
it('should work with async "postprocessor" function option', async () => {
const compiler = getCompiler("preprocessor.hbs", {
postprocessor: async (content, loaderContext) => {
await expect(typeof content).toBe("string");
await expect(loaderContext).toBeDefined();
- return content.replace(/<%=/g, '" +').replace(/%>/g, '+ "');
+ const isTemplateLiteralSupported = content[0] === "`";
+
+ return content
+ .replace(/<%=/g, isTemplateLiteralSupported ? `\${` : '" +')
+ .replace(/%>/g, isTemplateLiteralSupported ? "}" : '+ "');
},
});
const stats = await compile(compiler);