Skip to content

Commit

Permalink
allow whitespaces before closing '>'
Browse files Browse the repository at this point in the history
  • Loading branch information
Lms24 committed Oct 14, 2022
1 parent 157f8ea commit ed12846
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/svelte/src/preprocessors.ts
Expand Up @@ -127,7 +127,7 @@ function hasScriptTag(content: string): boolean {
// They use this regex to find matching script tags that are passed to the `script` preprocessor hook:
// https://github.com/sveltejs/svelte/blob/bb83eddfc623437528f24e9fe210885b446e72fa/src/compiler/preprocess/index.ts#L144
// However, we remove the first part of the regex to not match HTML comments
const scriptTagRegex = /<script(\s[^]*?)?(?:>([^]*?)<\/script>|\/>)/gi;
const scriptTagRegex = /<script(\s[^]*?)?(?:>([^]*?)<\/script\s*>|\/>)/gi;

// Regex testing is not a super safe way of checking for the presence of a <script> tag in the Svelte
// component file but I think we can use it as a start.
Expand Down

0 comments on commit ed12846

Please sign in to comment.