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

Fast refreshing is very slow had to wait along time for it to update. #50361

Closed
1 task done
Haseebshah936 opened this issue May 25, 2023 · 18 comments
Closed
1 task done
Labels
area: app App directory (appDir: true) bug Issue was opened via the bug report template. locked Turbopack Related to Turbopack with Next.js.

Comments

@Haseebshah936
Copy link

Haseebshah936 commented May 25, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Next 13.4.3

Node 18.12.1

Project was created with create-next-app@latest with tailwindCSS and shorthand @

Device

Mac book pro 14 M1"

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true), Script optimization (next/script), Turbopack (--turbo)

Link to the code that reproduces this issue or a replay of the bug

https://github.com/Haseebshah936/combat_companion

To Reproduce

You can see the code for the project here
https://github.com/Haseebshah936/combat_companion

Describe the Bug

I have been developing this site for my client in next 13 with app directory but any changes made inside the code are displayed very slow on localhost dev client. I have even tried --turbo but still it is very slow.

Expected Behavior

It should update the site as soon as I make any change in code

Which browser are you using? (if relevant)

Edge, Chrome

How are you deploying your application? (if relevant)

Vercel, next start

@Haseebshah936 Haseebshah936 added the bug Issue was opened via the bug report template. label May 25, 2023
@github-actions github-actions bot added area: app App directory (appDir: true) Turbopack Related to Turbopack with Next.js. labels May 25, 2023
@franckadil
Copy link

Can replicate, on Windows 11 and Ubuntu 22.04:

  • Node version : Lts/hydrogen (-> v18.16.0)
  • npm version: 9.5.1
  • Next v13.4.4

@oalexdoda
Copy link

Same issue here (without turbo) - 2 minutes for a build in appDir that would otherwise take 8 seconds in pages dir. And fast refresh is rebuilding everything vs. just the relevant modules (which doesn't happen in pages dir). Can't use turbopack because of module resolution errors so I haven't tried that, but it shouldn't take 20X more just because of appDir.

image

Running this on an 8-Core Intel Core i9 64 GB RAM so it's not a hardware resource issue.

@masterkain
Copy link

this is the only framework where in dev I'm scared to mousehover anything

@Haseebshah936
Copy link
Author

Haseebshah936 commented May 27, 2023

@masterkain @altechzilla I am also facing the issue with app dir and also if we run with turbo it just keep on loading. Also I am new to next and building a PWA for a client what do you guess suggest to do should. I switch to react? or pages as, I have to learn the pages router from scratch.

@joacub
Copy link

joacub commented May 27, 2023

this is the only framework where in dev I'm scared to mousehover anything

🤣 me too, I disabled it, too much scared haha, now I’m good but things are slow as always.

I’m just kidding. But look….

i don’t understand the claim they does about turbopack, i come to nextjs cause a lot of people was talking about turbopack and the claim they were saying was really promising. But TURBOPACK is slower than webpack and by far. Only hmr is faster than webpack hmr. But is really a nightmare working on dev. And production has multiple issues, but well they can be manageable. DEV environment is just super super bad, is really frustrating. I hope they get the claim they said about turbopack I really think they will get at some point.

Don’t take me wrong I like the project, but you maybe have to focus first on polish this before enter in new features and keep the development environment working normal at least. Right now is really slow and frustrating.

@Haseebshah936
Copy link
Author

@joacub what do you suggest me in that case. I switched to 13.2.4 the normal dev mode with out turbo pack got better but still not what I was expecting it to be. As I mentioned above I am working on a major business site for my client and it's a PWA as well. Due to the hype of next js specially next 13 and the upgrades the promised in it, I spent time in learning next 13 with app dir but after building just the landing page for the site. I am feeling that it's not what I was expecting it to be. So I am thinking of switching back to react. What do you suggest on this as it is not too late for me and shifting the code will not take more than a day.

@masterkain
Copy link

just bought a i9-13900KF, what can you do, let's see if it improves the situation, it does not help the fact that I'm running in docker even in dev

@joacub
Copy link

joacub commented May 27, 2023

@joacub what do you suggest me in that case. I switched to 13.2.4 the normal dev mode with out turbo pack got better but still not what I was expecting it to be. As I mentioned above I am working on a major business site for my client and it's a PWA as well. Due to the hype of next js specially next 13 and the upgrades the promised in it, I spent time in learning next 13 with app dir but after building just the landing page for the site. I am feeling that it's not what I was expecting it to be. So I am thinking of switching back to react. What do you suggest on this as it is not too late for me and shifting the code will not take more than a day.

It really depends, Nextjs at some point will get the heaven point. But still not mature. It really depends. Nextjs has some Benefits and some drawbacks. If is a simple project you may use a simple react application. Or just use remix run , they are less opinionated and has more open development experience. They are really fast but how I said it really depends.

if you need stability now try to go back to pages if you want to stick with next.

My opinion is let’s push nextjs team to improve the development experience (next team seems be really good) and they will get that sweet point faster and we will get benefit on not having to spend time in all the process that next already does.

@Haseebshah936
Copy link
Author

Haseebshah936 commented May 27, 2023

@joacub Thanks for reply and the site is very big site it's an event management system for booking and mma fights with match boxing and has around 8 different types of users. The thing is I am a freelancer and I have a good grip over react and has built PWA and large applications on it but to make a react site full secure, load balanced and achieving a good performance is a time taking work. One thing to mention here is I don't have any prior experience with any react frame work and I just read the docs of next 13 app dir route and got enough knowledge of how things are working in it and one big reason for selecting next is also it's SEO friendly nature.

@joacub
Copy link

joacub commented May 27, 2023

If you have any experience in any other then take nextjs as is well documented. Don’t develop in docker, nextjs is really slow in docker for some unexpected reason in dev. Develop in your host machine and it will faster. Don not import from barrel files and you will be fine. Next at some point will run faster. I saw some commits and I’m suspecting they are over charging app router with supporting pages at the same time. I’m just guessing as I don’t dig on this but it may be the cause that the support for legacy functions are getting app dir more heavy than expected and there may be other codes that are getting inside of app dir by mistake. So if I’m you I would take next. Performance in next may be no the best but static generation helps a lot. Ssr server next is somehow slow as they i think are using express which is not the fastest server and other factors that hurts. I may be wrong. But yeah that were not probably the bottleneck in the performance as I said next does a lot of static caches.

@oalexdoda
Copy link

oalexdoda commented May 29, 2023

just bought a i9-13900KF, what can you do, let's see if it improves the situation, it does not help the fact that I'm running in docker even in dev

I'm running on an i9 64GB RAM and it doesn't help at all. Gonna switch to an M2 Max 96GB RAM in a few days and hope for the best. Not sure if related to this:
#50332

@Haseebshah936
Copy link
Author

Haseebshah936 commented May 29, 2023 via email

@sannajammeh
Copy link
Contributor

Ran into the same issue. I noticed a node process using 1.8gb of ram on an 8gb system... Closed next and that process also exited.

This in turn made TS Server so slow it refused to perform automatic imports.

One thing that improved it was fixing Tailwind config. If you have one, make sure that your content globs do not match on node_modules. Reduced it by a bit, but still much slower than Pages dir

@Haseebshah936
Copy link
Author

In my case it is using upto 5.2 gb of ram when runing it takes 2.5gb to just start the server and then if I switch a page it spicks to 5.3gb. Right now what I am doing is developing the site on react and then moving the code next and converting it according to next 13 standards

@LuckyArdhika
Copy link

How nextjs is very popular while its make frustation development

@tgdn
Copy link

tgdn commented Nov 16, 2023

Any update on this?

NextJS 14 compiles changes in at least 20 seconds on a Turborepo project with one page.

@ForsakenHarmony
Copy link
Member

Closing this for now, we've made a lot of improvements since this issue was opened (and in the last 2 months)

If you have a specific project that's a lot slower with turbopack than webpack please open a new issue with a reproduction link

Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: app App directory (appDir: true) bug Issue was opened via the bug report template. locked Turbopack Related to Turbopack with Next.js.
Projects
None yet
Development

No branches or pull requests

9 participants