Skip to content

Commit

Permalink
fix: handle closing tags in attributes (#796)
Browse files Browse the repository at this point in the history
* fix: handle closing tags in attributes

...when detecting script language
Related to sveltejs/language-tools#2204

* Update packages/vite-plugin-svelte/src/utils/compile.js

Co-authored-by: Dominik G. <[email protected]>

---------

Co-authored-by: Dominik G. <[email protected]>
  • Loading branch information
dummdidumm and dominikg authored Nov 22, 2023
1 parent 84d9fa9 commit 4b8918d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/eleven-wombats-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/vite-plugin-svelte': patch
---

fix: handle closing tags in attributes when detecting script language
3 changes: 2 additions & 1 deletion packages/vite-plugin-svelte/src/utils/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { log } from './log.js';
import { createInjectScopeEverythingRulePreprocessorGroup } from './preprocess.js';
import { mapToRelative } from './sourcemaps.js';

const scriptLangRE = /<script [^>]*lang=["']?([^"' >]+)["']?[^>]*>/;
const scriptLangRE =
/<script (?:[^>]*|(?:[^=>'"/]+=(?:"[^"]*"|'[^']*'|[^>\s]+)\s+)*)lang=["']?([^"' >]+)["']?[^>]*>/;

import { isSvelte3, isSvelte5 } from './svelte-version.js';

Expand Down

0 comments on commit 4b8918d

Please sign in to comment.