mirror of
https://github.com/LukeHagar/redocly-cli.git
synced 2025-12-09 20:57:44 +00:00
fix: prevent failing in worker (#1478)
This commit is contained in:
5
.changeset/moody-parents-fry.md
Normal file
5
.changeset/moody-parents-fry.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@redocly/openapi-core": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Added a platform check so `@redocly/openapi-core` can support running inside a worker.
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
export const isBrowser =
|
export const isBrowser =
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
typeof window !== 'undefined' || typeof process === 'undefined'; // main and worker thread
|
typeof window !== 'undefined' ||
|
||||||
|
typeof process === 'undefined' ||
|
||||||
|
(process?.platform as any) === 'browser'; // main and worker thread
|
||||||
export const env = isBrowser ? {} : process.env || {};
|
export const env = isBrowser ? {} : process.env || {};
|
||||||
|
|||||||
Reference in New Issue
Block a user