-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to react-router v4 and code-splitting #841
Conversation
Refactoring routes.js to use Switch store now export history renamed router reducer switch to react-router-dom
Since this PR covers #832 (comment) too I've tried everything but it seems flow doesn't like the dynamic Should we ignore the lines with these declarations? |
That would be a good idea for the time being. Also do you know why the end to end testes are failing? |
Got it, I think it has to do with the new router that needs wrapping the provider of the test CounterPage because is contains |
import type { Children } from 'react'; | ||
|
||
type Props = {children: Children, load: () => Promise<*>}; | ||
class Bundle extends Component { |
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.
nit: convention is to use a new line before class declarations
@@ -0,0 +1,45 @@ | |||
// @flow |
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.
What exactly is this Bundle
container necessary? Some inline comments explaining why this is necessary would be nice
} | ||
} | ||
|
||
props: Props |
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.
nit: Type declarations should come before methods and properties
Closing in favor of #884 |
As mentioned in #808
This PR switches to React router v4 with dynamic import for code splitting.
I first tried using the
bundle-loader
but then went toward theimport
promise as specified from https://reacttraining.com/react-router/web/guides/code-splitting and didn't useSystem.import
as it will deprecate in Webpack3 ( https://survivejs.com/webpack/building/code-splitting/ )Split point are created like it should:
And you can see them being loaded in the Network Devtools when navigating.
Dynamic import provides less functionality than require.ensure. While it's possible to handle errors with it, features like naming are available for require.ensure only.
Great boilerplate guys 馃憤