Skip to content

Commit

Permalink
fix($preload): display warning if preload fails
Browse files Browse the repository at this point in the history
  • Loading branch information
faceyspacey committed Jun 30, 2017
1 parent 69c6a02 commit c2ac903
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand All @@ -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) {
Expand Down

0 comments on commit c2ac903

Please sign in to comment.