File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -33,9 +33,19 @@ export const parsers: Record<string, Parser> = {
3333 hasPragma,
3434 parse : async ( text , options : ParserOptions ) => {
3535 try {
36- const _parse = options . svelte5CompilerPath
37- ? ( await import ( options . svelte5CompilerPath ) ) . parse
38- : parse ;
36+ let _parse = parse ;
37+ if ( options . svelte5CompilerPath ) {
38+ try {
39+ _parse = ( await import ( options . svelte5CompilerPath ) ) . parse ;
40+ } catch ( e ) {
41+ console . warn (
42+ `Failed to load Svelte 5 compiler from ${ options . svelte5CompilerPath } ` ,
43+ ) ;
44+ console . warn ( e ) ;
45+ options . svelte5CompilerPath = undefined ;
46+ }
47+ }
48+
3949 return < ASTNode > { ..._parse ( text ) , __isRoot : true } ;
4050 } catch ( err : any ) {
4151 if ( err . start != null && err . end != null ) {
You can’t perform that action at this time.
0 commit comments