From c2ac90370c77daaaa5e26f5a163ddc61b1759ad7 Mon Sep 17 00:00:00 2001 From: James Gillmore <james@faceyspacey.com> Date: Thu, 29 Jun 2017 22:05:47 -0700 Subject: [PATCH] fix($preload): display warning if preload fails --- src/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 23babe8..956eca0 100644 --- a/src/index.js +++ b/src/index.js @@ -41,6 +41,7 @@ const DefaultLoading = () => <div>Loading...</div> const DefaultError = () => <div>Error!</div> const isServer = typeof window === 'undefined' +const DEV = process.env.NODE_ENV === 'development' export default function universal<Props: Props>( component: AsyncComponent<Props>, @@ -61,7 +62,9 @@ export default function universal<Props: Props>( _mounted: boolean static preload() { - requireAsync().catch(() => {}) + requireAsync().catch(e => { + if (DEV) console.warn('[react-universal-component] preload failed:', e) + }) } constructor(props: Props) {