Skip to content

Commit ed12846

Browse files
committed
allow whitespaces before closing '>'
1 parent 157f8ea commit ed12846

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/svelte/src/preprocessors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function hasScriptTag(content: string): boolean {
127127
// They use this regex to find matching script tags that are passed to the `script` preprocessor hook:
128128
// https://github.com/sveltejs/svelte/blob/bb83eddfc623437528f24e9fe210885b446e72fa/src/compiler/preprocess/index.ts#L144
129129
// However, we remove the first part of the regex to not match HTML comments
130-
const scriptTagRegex = /<script(\s[^]*?)?(?:>([^]*?)<\/script>|\/>)/gi;
130+
const scriptTagRegex = /<script(\s[^]*?)?(?:>([^]*?)<\/script\s*>|\/>)/gi;
131131

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

0 commit comments

Comments
 (0)