prevent compiled output blowing up in Node if window is not defined

pull/2963/head
Richard Harris 6 years ago committed by Conduitry
parent f60ae53d76
commit 788cf97a93

@ -1,3 +1,5 @@
const win = typeof window !== 'undefined' ? window : global;
const { const {
// ecmascript // ecmascript
Error, Error,
@ -15,9 +17,8 @@ const {
getComputedStyle, getComputedStyle,
navigator, navigator,
requestAnimationFrame, requestAnimationFrame,
setTimeout: export_setTimeout, // TODO: remove when upgrading typescript, bug setTimeout: export_setTimeout // TODO: remove when upgrading typescript, bug
window: export_window, } = win as unknown as typeof globalThis;
} = (window || global) as unknown as typeof globalThis;
export { export {
// ecmascript // ecmascript
@ -37,5 +38,5 @@ export {
navigator, navigator,
requestAnimationFrame, requestAnimationFrame,
export_setTimeout as setTimeout, export_setTimeout as setTimeout,
export_window as window, win as window,
}; };

Loading…
Cancel
Save