diff --git a/examples/async/index.js b/examples/async/index.js index 1b2dae31948..fa05e8e874c 100644 --- a/examples/async/index.js +++ b/examples/async/index.js @@ -3,32 +3,40 @@ import React from 'react' import ReactDOM from 'react-dom' import { Provider } from 'react-redux' import configureStore from './store/configureStore' -import App from './containers/App' const store = configureStore() const rootEl = document.getElementById('root') -function render(rootReactEl) { +let render = () => { + const App = require('./containers/App').default ReactDOM.render( - {rootReactEl} + , rootEl ) } -render() - if (module.hot) { - module.hot.accept('./containers/App', () => { + const renderApp = render + const renderError = (error) => { const RedBox = require('redbox-react') - const UpdatedApp = require('./containers/App').default - setTimeout(() => { - try { - render() - } catch (error) { - render() - } - }) + ReactDOM.render( + , + rootEl + ) + } + render = () => { + try { + renderApp() + } catch (error) { + renderError(error) + } + } + module.hot.accept('./containers/App', (err) => { + console.error('hey', err) + setTimeout(render) }) } + +render() diff --git a/examples/async/webpack.config.js b/examples/async/webpack.config.js index f71daecee20..038e12dd32a 100644 --- a/examples/async/webpack.config.js +++ b/examples/async/webpack.config.js @@ -15,7 +15,6 @@ module.exports = { plugins: [ new webpack.optimize.OccurenceOrderPlugin(), new webpack.HotModuleReplacementPlugin(), - new webpack.NoErrorsPlugin() ], module: { loaders: [