From 522b9a694d4b536a943fe06227d4469b374ea5ba Mon Sep 17 00:00:00 2001 From: Jinksi Date: Sat, 14 Oct 2017 11:34:41 +1000 Subject: [PATCH] Dynamically import netlifyIdentity --- src/App.js | 1 + src/index.js | 1 - src/netlifyIdentity.js | 4 +++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/App.js b/src/App.js index 607872f..ac45eaa 100644 --- a/src/App.js +++ b/src/App.js @@ -19,6 +19,7 @@ export const siteTitle = 'HyperStatic' class App extends Component { componentWillMount () { globalStyles() + import('./netlifyIdentity') } render () { diff --git a/src/index.js b/src/index.js index 841aab3..b34a9f7 100644 --- a/src/index.js +++ b/src/index.js @@ -2,7 +2,6 @@ import React from 'react' import { render } from 'react-snapshot' import App from './App' import registerServiceWorker from './registerServiceWorker' -import './netlifyIdentity' const rootEl = document.getElementById('root') render(, rootEl) diff --git a/src/netlifyIdentity.js b/src/netlifyIdentity.js index 39f6ba8..6022436 100644 --- a/src/netlifyIdentity.js +++ b/src/netlifyIdentity.js @@ -9,4 +9,6 @@ netlifyIdentity.on('init', user => { } }) -netlifyIdentity.init() +if (window.localStorage) { + netlifyIdentity.init() +}