From 93bf408a0e61d54a872d68949d05a78057ebff46 Mon Sep 17 00:00:00 2001 From: Andriy Leliv Date: Thu, 8 Apr 2021 15:30:27 +0300 Subject: [PATCH] chore: isBrowser verification improvment --- src/utils/loadAndBundleSpec.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/utils/loadAndBundleSpec.ts b/src/utils/loadAndBundleSpec.ts index 1748d112..092e5771 100644 --- a/src/utils/loadAndBundleSpec.ts +++ b/src/utils/loadAndBundleSpec.ts @@ -11,15 +11,16 @@ export async function loadAndBundleSpec(specUrlOrObject: object | string): Promi base: IS_BROWSER ? window.location.href : process.cwd() } + if (IS_BROWSER) { + config.resolve.http.customFetch = global.fetch; + } + if (typeof specUrlOrObject === 'object' && specUrlOrObject !== null) { bundleOpts['doc'] = { source: { absoluteRef: '' } as Source, parsed: specUrlOrObject } as Document } else { - if (IS_BROWSER) { - config.resolve.http.customFetch = global.fetch; - } bundleOpts['ref'] = specUrlOrObject; }