File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
packages/repl/src/lib/workers Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -457,7 +457,11 @@ async function get_bundle(
457
457
if ( id === `${ VIRTUAL } /${ ESM_ENV } ` ) return ;
458
458
if ( id . endsWith ( '.svelte' ) ) return ;
459
459
460
- add_tailwind_candidates ( this . parse ( code ) ) ;
460
+ try {
461
+ // Don't let a parser/tailwind error crash the bundler
462
+ // Can happen for files that begin with a bash shebang
463
+ add_tailwind_candidates ( this . parse ( code ) ) ;
464
+ } catch { }
461
465
}
462
466
}
463
467
] ,
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ self.window = self;
10
10
11
11
declare var self : Window & typeof globalThis & { svelte : typeof import ( 'svelte/compiler' ) } ;
12
12
13
- const cache : Record < string , any > = { } ;
13
+ const cache : Record < string , Promise < any > > = { } ;
14
14
15
15
addEventListener ( 'message' , async ( event ) => {
16
16
const { id, file, version, options } = event . data as {
@@ -20,7 +20,11 @@ addEventListener('message', async (event) => {
20
20
options : ExposedCompilerOptions ;
21
21
} ;
22
22
23
- const { can_use_experimental_async, svelte } = ( cache [ version ] ??= await load_svelte ( version ) ) ;
23
+ cache [ version ] ??= load_svelte ( version ) ;
24
+ cache [ version ] . catch ( ( ) => {
25
+ delete cache [ version ] ;
26
+ } ) ;
27
+ const { can_use_experimental_async, svelte } = await cache [ version ] ;
24
28
25
29
if ( ! file . name . endsWith ( '.svelte' ) && ! svelte . compileModule ) {
26
30
// .svelte.js file compiled with Svelte 3/4 compiler
You can’t perform that action at this time.
0 commit comments