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(
457457 if ( id === `${ VIRTUAL } /${ ESM_ENV } ` ) return ;
458458 if ( id . endsWith ( '.svelte' ) ) return ;
459459
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 { }
461465 }
462466 }
463467 ] ,
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ self.window = self;
1010
1111declare var self : Window & typeof globalThis & { svelte : typeof import ( 'svelte/compiler' ) } ;
1212
13- const cache : Record < string , any > = { } ;
13+ const cache : Record < string , Promise < any > > = { } ;
1414
1515addEventListener ( 'message' , async ( event ) => {
1616 const { id, file, version, options } = event . data as {
@@ -20,7 +20,11 @@ addEventListener('message', async (event) => {
2020 options : ExposedCompilerOptions ;
2121 } ;
2222
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 ] ;
2428
2529 if ( ! file . name . endsWith ( '.svelte' ) && ! svelte . compileModule ) {
2630 // .svelte.js file compiled with Svelte 3/4 compiler
You can’t perform that action at this time.
0 commit comments