@@ -13,7 +13,7 @@ import {
1313 isJsonModuleResponse ,
1414 type RemoteModuleFetchResult ,
1515} from "./module-fetch" ;
16- import { isBrowserRuntime } from "./runtime-environment" ;
16+ import { isBrowserRuntime , isNodeRuntime } from "./runtime-environment" ;
1717import { isHttpUrl } from "./runtime-specifier" ;
1818
1919export interface RuntimeSourceModuleLoaderOptions {
@@ -582,12 +582,7 @@ export class RuntimeSourceModuleLoader {
582582 }
583583
584584 this . nodeModuleResolverPromise = ( async ( ) => {
585- if (
586- typeof process === "undefined" ||
587- typeof process . versions !== "object" ||
588- process . versions === null ||
589- typeof process . versions . node !== "string"
590- ) {
585+ if ( ! isNodeRuntime ( ) ) {
591586 return undefined ;
592587 }
593588
@@ -618,12 +613,7 @@ export class RuntimeSourceModuleLoader {
618613 }
619614
620615 this . nodePathToFileUrlPromise = ( async ( ) => {
621- if (
622- typeof process === "undefined" ||
623- typeof process . versions !== "object" ||
624- process . versions === null ||
625- typeof process . versions . node !== "string"
626- ) {
616+ if ( ! isNodeRuntime ( ) ) {
627617 return undefined ;
628618 }
629619
@@ -649,12 +639,7 @@ export class RuntimeSourceModuleLoader {
649639 }
650640
651641 this . nodePathModulePromise = ( async ( ) => {
652- if (
653- typeof process === "undefined" ||
654- typeof process . versions !== "object" ||
655- process . versions === null ||
656- typeof process . versions . node !== "string"
657- ) {
642+ if ( ! isNodeRuntime ( ) ) {
658643 return undefined ;
659644 }
660645
0 commit comments