Skip to content

Commit 9949d82

Browse files
fix: handle text with <script> in the script element (#444)
1 parent 36cbff6 commit 9949d82

File tree

5 files changed

+30
-27
lines changed

5 files changed

+30
-27
lines changed

src/utils.js

+3
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,9 @@ export function getModuleCode(html, replacements) {
12371237
}
12381238
}
12391239

1240+
// Replaces "<script>" or "</script>" to "<" + "script>" or "<" + "/script>".
1241+
code = code.replace(/<(\/?script)/g, (_, s) => `<" + "${s}`);
1242+
12401243
return `// Module\n${replacersCode}var code = ${code};\n`;
12411244
}
12421245

test/__snapshots__/esModule-option.test.js.snap

+3-3
Large diffs are not rendered by default.

test/__snapshots__/loader.test.js.snap

+2-2
Large diffs are not rendered by default.

test/__snapshots__/minimize-option.test.js.snap

+6-6
Large diffs are not rendered by default.

test/__snapshots__/sources-option.test.js.snap

+16-16
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)