-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Lazy compilation during development #608
Comments
Added bonus: pre-fetching would trigger the lazy compilation of additional routes, so that's a very neat way of "doing work in the background". Side note: a priority queue in place to always put direct routing work ahead of prefetching would be nice (but not a must) |
I didn't get this 100%. Is this what do you mean.
|
Correct. Right now it builds everything. If anything, I'd rather bind to the port immediately, and then we could start compiling |
Okay. That's interesting. |
We used to have most of this feature on the old unpublished version of next.js. So actually, we can say it definitely improves your development experience a lot. The only issue I feel on this feature is it makes response time of your app totally different compared to production. I have no concrete idea how we could do it but maybe should wait for webpack/webpack#3634 to be merged, which should make things a lot easier. |
@nkzawa I thought dynamic entries are something already supported by webpack. |
@nkzawa it's true that it introduces a difference with production. We should have a flag |
@rauchg @nkzawa I think we need to find a better solution than this one. Basically it only have a single page, but with source maps enabled it took around ~10 seconds. Even without webpack it took around ~2 seconds for changes. Mostly this is because of the use of |
I'm going to see whether adding tree-shaking support gives us something better. |
There's a way to do this properly. We could pick all the common modules and serve them as a DDL. So, nothing inside pages directory deals with Webpack at all. So, that's where we could get the speed. I think we need to work hard to do this automatically, but we don't wanna do it like that. I'll try to work on this. If we can land this before 2.0, that would be huge. |
This was implemented in #1111. Please do re-open if needed 😄 |
In order to make Next.js very performant, we need to address the following problems:
next
, everything gets compiled eagerlyThe beautiful thing about our new compilation output is that it makes these problems very obvious and clear :)
The text was updated successfully, but these errors were encountered: