@@ -475,23 +475,25 @@ function loadSourceFiles(
475475
476476 const fetchPromise =
477477 dedupedFetchPromises . get ( runtimeSourceURL ) ||
478- fetchFileFunction ( runtimeSourceURL ) . then ( runtimeSourceCode => {
479- // TODO (named hooks) Re-think this; the main case where it matters is when there's no source-maps,
480- // because then we need to parse the full source file as an AST.
481- if ( runtimeSourceCode . length > MAX_SOURCE_LENGTH ) {
482- throw Error ( 'Source code too large to parse' ) ;
483- }
478+ ( runtimeSourceURL && ! runtimeSourceURL . startsWith ( '<anonymous' )
479+ ? fetchFileFunction ( runtimeSourceURL ) . then ( runtimeSourceCode => {
480+ // TODO (named hooks) Re-think this; the main case where it matters is when there's no source-maps,
481+ // because then we need to parse the full source file as an AST.
482+ if ( runtimeSourceCode . length > MAX_SOURCE_LENGTH ) {
483+ throw Error ( 'Source code too large to parse' ) ;
484+ }
484485
485- if ( __DEBUG__ ) {
486- console . groupCollapsed (
487- `loadSourceFiles() runtimeSourceURL "${ runtimeSourceURL } "` ,
488- ) ;
489- console . log ( runtimeSourceCode ) ;
490- console . groupEnd ( ) ;
491- }
486+ if ( __DEBUG__ ) {
487+ console . groupCollapsed (
488+ `loadSourceFiles() runtimeSourceURL "${ runtimeSourceURL } "` ,
489+ ) ;
490+ console . log ( runtimeSourceCode ) ;
491+ console . groupEnd ( ) ;
492+ }
492493
493- return runtimeSourceCode ;
494- } ) ;
494+ return runtimeSourceCode ;
495+ } )
496+ : Promise . reject ( new Error ( 'Empty url' ) ) ) ;
495497 dedupedFetchPromises . set ( runtimeSourceURL , fetchPromise ) ;
496498
497499 setterPromises . push (
0 commit comments