test: refactoring tests

This commit is contained in:
2024-01-27 20:54:59 +01:00
parent 3e46055845
commit 1c55b894c9
7 changed files with 86 additions and 38 deletions

View File

@@ -265,6 +265,7 @@ export default function html(opts: RollupHtmlOptions = {}): Plugin {
} while (nodeQueue.length > 0);
}
// Beware leak of AST (we're starting MagicString on a parsed and modified version of the HTML file, sourcemappings in the HTML file will be off. (can't add a sourcemap for a html file anyway, unless it is outputted as JS module)
let htmlJS = new MagicString(serializeHtml(htmlModule.document));
htmlJS.replaceAll(/`/g,'\\\`').replaceAll(/\$\{/g,'\\${');