Skip to content
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

code splitting example with webpack 2 #4344

Closed
kimown opened this issue Jan 18, 2017 · 3 comments
Closed

code splitting example with webpack 2 #4344

kimown opened this issue Jan 18, 2017 · 3 comments

Comments

@kimown
Copy link

kimown commented Jan 18, 2017

Hi, webpack has released 2.2.0, so we can use import to load module dynamically, so I think an official example about react-router and webpack 2 is very necessary.

@justinmasse
Copy link

That would be fantastic, been trying to figure out this problem today myself.

@timdorr
Copy link
Member

timdorr commented Jan 18, 2017

I added Promise support to the async functions in #3719. There are some examples in the tests: https://github.com/ReactTraining/react-router/pull/3719/files#diff-7f51f7b8bcc1ab598f60a81f4bc21724

This is probably better represented as a PR. If you want to put something together, we can definitely work on getting it added in.

@timdorr timdorr closed this as completed Jan 18, 2017
@marcofugaro
Copy link

So will this work?

<Route path='/page' render={() => import('./components/page')} />

Will webpack effectively split my code by creating a "page.js" file and requesting it only when I navigate to the url /page?

@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants