chore: isBrowser verification improvment

This commit is contained in:
Andriy Leliv 2021-04-08 15:30:27 +03:00
parent 101bf62556
commit 93bf408a0e

View File

@ -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;
}