Super slow page load times in development environment #17977
-
Beta Was this translation helpful? Give feedback.
Replies: 39 comments 69 replies
-
@arthurva Did you find an answer to the question if this response time is expected for a full page reload during development? I am experiencing a similar loading time. Im my case it is 5 seconds, but the resource _app.js is even larger (3.2 MB transferred, 42 MB uncompressed). I guess this long time goes into bundling. Fast Refresh also exists to have instant feedback when editing a page. But once in a while I prefere to reload the page completely. Like you I also wonder if this long page load time is really expected. |
Beta Was this translation helpful? Give feedback.
-
I'm experiencing the same result on a large application, it takes minutes on initial boot and then quite some time for the fast refresh to complete. I can't find any output on what's going on behind the scenes, what exactly is being compiled and how long it's taking. Are there any resources I can use to analyse/troubleshoot? |
Beta Was this translation helpful? Give feedback.
-
Are you guys using getStaticProps in conjunction with getStaticPaths on dynamic pages? I experienced the same issues and unfortunately only after converting all dynamic pages to use getServerSideProps the situation improved significantly. |
Beta Was this translation helpful? Give feedback.
-
I experience this, about 1 min to run next dev and very slow to do link transitions using next/link. It makes developing with vercel quite painful sometimes. |
Beta Was this translation helpful? Give feedback.
-
Thnk i like it
…On Wed, 19 May 2021, 02:07 Alan Smithee, ***@***.***> wrote:
@timneutkens <https://github.com/timneutkens>
In my case, I do have a custom next.js config, but a simple one. I also
have a custom server, which slows down the original startuptime, but
shouldn't affect hot-reloading, right?
My repo is private, but I sent you an invite if you'd like to have a look.
Thanks in advance!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#17977 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AUDSHSPNOB7HB6HPOOOI7BTTOKUHJANCNFSM4SURSZIQ>
.
|
Beta Was this translation helpful? Give feedback.
-
Has anyone figured out what causes this? I'm using TailwindCSS and it takes at least 5seconds between pages in development, but it's very snappy when hosted. This site is really small too, so there's really no reason it should be doing this unless there's something adding to the development compile time...or? |
Beta Was this translation helpful? Give feedback.
-
In my case, this problem was solved just clearing my data configs on the tab aplication > storage in Chrome |
Beta Was this translation helpful? Give feedback.
-
I'm experiencing this issue when I'm using Google Chrome. Switching to Firefox (or maybe to another browser, but didn't try), sorted this out for me. |
Beta Was this translation helpful? Give feedback.
-
Any updates on this? |
Beta Was this translation helpful? Give feedback.
-
Also experiencing this with a lightweight application loaded with TailwindUI in Chrome |
Beta Was this translation helpful? Give feedback.
-
Painful to develop with this slowness. Any clues to make this faster? |
Beta Was this translation helpful? Give feedback.
-
I think we should if that will bring attention to this issue.
…On Wed, Oct 13, 2021 at 10:43 PM Hugo Nogueira ***@***.***> wrote:
Agree! Same for our team here. Seems like it's an old issue: #4844
<#4844>
Should we comment on the open issue to check if there's any position from
the official maintainers?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#17977 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEMS5UY4DSZH6FPPAXREXDUGXOOZANCNFSM4SURSZIQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Beta Was this translation helpful? Give feedback.
-
I managed to solve my issues in two steps:
|
Beta Was this translation helpful? Give feedback.
-
Hello I was also facing this issue, I noticed that after changing browser from brave to chrome, it is fixed. It seems browser issue. In brave browser I am facing this issue, the main bundle size is 1Mb, but it loads faster in chrome but not in brave. Also hot reloading not working in brave. |
Beta Was this translation helpful? Give feedback.
-
For anyone coming to this issue, I think I have the answer! After looking at these comments and trying all of their solutions, the only one that worked was either switching browsers or clearing my cache for localhost:3000 It appears to me that the browser is storing a bunch of unnecessary data from previous builds (every time you make a change to the code base and reload the webpack bundle changes). I was having to wait minutes for the initial load and upwards of a minute for page transitions, but after clearing cache my initial load is below 10 seconds and page transitions are instant if the page has been cached, if not it is taking 2-3 seconds. |
Beta Was this translation helpful? Give feedback.
-
To anybody still facing this issue, it's most likely because of tree shaking. Using libraries like MUI often causes your app to load ALL modules while in development mode. Here's a simple (yet experimental) solution that helps you avoid having to do things like including each component individually. Add this to your next.config.js, especially for @mui or Lodash:
You can use this to transform any module you want, as documented here: I hope this helps and that Next.js figures out a way to automatically modularize imports instead of requiring it to be an opt-in per module. |
Beta Was this translation helpful? Give feedback.
-
Not only nextjs dev is quite slow. It also throws memory-leaking error after a few HMR. I'm using the new
|
Beta Was this translation helpful? Give feedback.
-
After a few tests, I came with the conclusion that the problem was something in my computer. I was unable to get a decent performance with Windows or WSL. The solution was to use a remote server for development with VSCode, and it was surprisingly ease (see how to do it here: https://code.visualstudio.com/docs/remote/ssh#_ssh-host-setup). Hope you guys get a better devx! |
Beta Was this translation helpful? Give feedback.
-
Try closing the dev tools if you're on chrome. When I have the network tab open it takes 15+ seconds but whenever I don't have it opened, It instantly loads. None of the ideas on here worked for me. but I hope this helps someone. |
Beta Was this translation helpful? Give feedback.
-
I have this problem too. For me the loading time was around 40s, and I'm using tailwindcss. The solution for me was the tailwind.config.js. `/** @type {import('tailwindcss').Config} */ content: ["./src/**/*.{js,ts,jsx,tsx}"], I created a src folder and put the pages folder in it. And change the config |
Beta Was this translation helpful? Give feedback.
-
Just ran into this problem. Clearing the cache helped |
Beta Was this translation helpful? Give feedback.
-
There is possibility that you are using Babel istead of SWC compiler: |
Beta Was this translation helpful? Give feedback.
-
Had the same issue with open dev tools and searched for quite some time. In my case disabling a chrome extension helped even though this extension was not actionable within the dev tools (Super Agent) |
Beta Was this translation helpful? Give feedback.
-
In my case I found that the issue is the time it takes the browser to download and parse the dev bundle. I wrote a script to analyze it and found that react-icons was absolutely massive; to fix it, i replaced react-icons with @react-icons/all-icons, and imported the icons individually. This halved the page load time. The python script is below, if anyone else wants to try this. # Call like: python next-dev-bundle-analyze.py .next/static/chunks/pages/_app.js | sort -n
import sys
mod = ""
prefix = '/***/ "../../node_modules/'
for l in open(sys.argv[1]):
if l.startswith(prefix):
mod = l[len(prefix):].strip()
elif l.startswith('eval('):
print("%s\t%s" % (len(l), mod)) |
Beta Was this translation helpful? Give feedback.
-
I am also getting slow initial page load but when using |
Beta Was this translation helpful? Give feedback.
-
Has anyone found a solution to this problem after all? I'm experiencing the same issue. I have a page that uses dynamic routing and fetches data through RTK Query in getServerSideProps (using next redux wrapper). It takes about 7 seconds to load the page if it's the first time. After the initial load, it loads faster (around 2 seconds). However, once the cache is cleared, it takes a long time to load again. I can't figure out what the problem is. In the DevTools Network tab, during the loading, it simply shows the JSON file in a pending state, nothing unusual. In my case, it's not specific to the development mode either. The page loads slowly on Vercel for the first time as well. Can anyone at least provide a clue about the cause? :( My package.json:
|
Beta Was this translation helpful? Give feedback.
-
For NextJS 13: add the modularizeImports if you are using material design: `/** @type {import('next').NextConfig} / module.exports = nextConfig` |
Beta Was this translation helpful? Give feedback.
-
My development enviroment was taking 40s to load. I removed depedencies, switched the browser, cleared the cache, and even download a brand new Then, when I disabled my wi-fi, the application went way too fast, from 40s to ~100ms. So, I connected to another wi-fi (now I am using my phone hotspot mode) and the problem is "gone" It's a good quick-fix, there's probably some configuation I have to change in my wi-fi, change its channel or something like that, but for now, using my phone as hotspot is way better. |
Beta Was this translation helpful? Give feedback.
-
My dev env was taking around 12-15 seconds to load and fast refresh was also not working whenever I made a change in the code. I had to refresh the whole page in order to see the change. Now it's working as expected. I was using a icons library |
Beta Was this translation helpful? Give feedback.
-
I'm consolidating all these reports into a single place, which provides steps on how you can help investigate: #48748 (comment) Going to lock this thread in favor of that issue. |
Beta Was this translation helpful? Give feedback.
I'm consolidating all these reports into a single place, which provides steps on how you can help investigate: #48748 (comment)
Going to lock this thread in favor of that issue.