Skip to content

Commit

Permalink
fix: handle text with <script> in the script element (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Jun 15, 2022
1 parent 36cbff6 commit 9949d82
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 27 deletions.
3 changes: 3 additions & 0 deletions src/utils.js
Expand Up @@ -1237,6 +1237,9 @@ export function getModuleCode(html, replacements) {
}
}

// Replaces "<script>" or "</script>" to "<" + "script>" or "<" + "/script>".
code = code.replace(/<(\/?script)/g, (_, s) => `<" + "${s}`);

return `// Module\n${replacersCode}var code = ${code};\n`;
}

Expand Down
6 changes: 3 additions & 3 deletions test/__snapshots__/esModule-option.test.js.snap

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions test/__snapshots__/loader.test.js.snap

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions test/__snapshots__/minimize-option.test.js.snap

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions test/__snapshots__/sources-option.test.js.snap

Large diffs are not rendered by default.

0 comments on commit 9949d82

Please sign in to comment.