-
Notifications
You must be signed in to change notification settings - Fork 9
react-hot-loader v3 #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ function getEntry (entry/* : ?(string | Object | Array<*>) */) { | |
| return { | ||
| entry: { | ||
| bundle: [ | ||
| 'react-hot-loader/patch', | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it may not be as clean to do this here, but we should probably only add this if |
||
| 'sanitize.css/sanitize.css', | ||
| 'tachyons-clears', | ||
| 'tachyons-display', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ import InjectTapEventPlugin from 'react-tap-event-plugin' | |
| import Rollbar from 'rollbar/dist/rollbar.umd.min' | ||
| import { Provider } from 'react-redux' | ||
| import { BrowserRouter as Router } from 'react-router-dom' | ||
| import { AppContainer } from 'react-hot-loader' | ||
| import configureStore from 'src/redux/store' | ||
| import { loadSuccess } from 'src/redux/modules/init' | ||
| import rollbarConfig from 'config/rollbar' | ||
|
|
@@ -48,19 +49,39 @@ window.onload = () => { | |
|
|
||
| } | ||
|
|
||
| ReactDOM.render( | ||
| const render = (Root: React$Element<*>) => { | ||
|
|
||
| ReactDOM.render( | ||
| <AppContainer> | ||
| { Root } | ||
| </AppContainer>, | ||
| document.getElementById('react-mount') | ||
| ) | ||
|
|
||
| } | ||
|
|
||
| const App = ( | ||
| <Provider store={store}> | ||
| <MuiThemeProvider muiTheme={getMuiTheme()}> | ||
| <Router> | ||
| <Routes /> | ||
| </Router> | ||
| </MuiThemeProvider> | ||
| </Provider>, | ||
|
|
||
| document.getElementById('react-mount') | ||
| </Provider> | ||
| ) | ||
|
|
||
| render(App) | ||
|
|
||
| if (module.hot) { | ||
|
|
||
| module.hot.accept('src/routes', () => { | ||
|
|
||
| render(App) | ||
|
|
||
| }) | ||
|
|
||
| } | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you try out the new relaxed arrow function lint rules?? ...we can now do this: 😉 if (module.hot) module.hot.accept('src/routes', () => render(App)) |
||
|
|
||
| // Progressively apply ServiceWorker updates so browser can simply be refreshed | ||
| // to reflect changes with window.location.reload() | ||
| // TODO: Fire redux action | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this working? I think this only adds it if
NODE_ENV=testWe might want to make a separate
"development"property for the dev plugins like this one and see how that works