Commit be458aa 1 parent c2271c0 commit be458aa Copy full SHA for be458aa
File tree 1 file changed +6
-6
lines changed
packages/vite/src/node/optimizer
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -359,7 +359,8 @@ const srcRE = /\bsrc\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i
359
359
const typeRE = / \b t y p e \s * = \s * (?: " ( [ ^ " ] + ) " | ' ( [ ^ ' ] + ) ' | ( [ ^ \s ' " > ] + ) ) / i
360
360
const langRE = / \b l a n g \s * = \s * (?: " ( [ ^ " ] + ) " | ' ( [ ^ ' ] + ) ' | ( [ ^ \s ' " > ] + ) ) / i
361
361
const svelteScriptModuleRE =
362
- / \b c o n t e x t \s * = \s * (?: " ( [ ^ " ] + ) " | ' ( [ ^ ' ] + ) ' | ( [ ^ \s ' " > ] + ) ) | \b (?< ! = ) (?< ! [ ' " ] ) ( m o d u l e ) \b (? ! [ ' " ] ) (? ! [ ^ > ] + [ ' " ] \s * > ) / i
362
+ / \b c o n t e x t \s * = \s * (?: " ( [ ^ " ] + ) " | ' ( [ ^ ' ] + ) ' | ( [ ^ \s ' " > ] + ) ) / i
363
+ const svelteModuleRE = / \s ( m o d u l e ) \b / i
363
364
364
365
function esbuildScanPlugin (
365
366
environment : ScanEnvironment ,
@@ -568,12 +569,11 @@ function esbuildScanPlugin(
568
569
// star exports, we need to ignore exports in <script>
569
570
if ( p . endsWith ( '.svelte' ) ) {
570
571
const contextMatch = svelteScriptModuleRE . exec ( openTag )
572
+ const moduleMatch = svelteModuleRE . exec ( openTag )
571
573
const context =
572
- contextMatch &&
573
- ( contextMatch [ 1 ] ||
574
- contextMatch [ 2 ] ||
575
- contextMatch [ 3 ] ||
576
- contextMatch [ 4 ] )
574
+ ( contextMatch &&
575
+ ( contextMatch [ 1 ] || contextMatch [ 2 ] || contextMatch [ 3 ] ) ) ||
576
+ ( moduleMatch && moduleMatch [ 1 ] )
577
577
578
578
if ( context !== 'module' ) {
579
579
addedImport = true
You can’t perform that action at this time.
0 commit comments