Your NextJS App is Too Big

Sdílet
Vložit
  • čas přidán 10. 09. 2024
  • NextJS is great! Those red numbers are scary tho. Hope this video helps you find some strategies to keep your Next app small and your user experience snappy!
    JOIN MY PATREON FOR EARLY ACCESS TO VIDEOS AND DIAGRAMS / t3dotgg
    Next Bundle Analyzer: github.com/ver...
    Idez killed it w/ this one so make sure he gets some love in the comments
    Twitch link: / theo
    Twitter link: / t3dotgg
    Discord link: t3.gg/discord
    Everything else (insta, tiktok, blog): t3.gg/faq
  • Věda a technologie

Komentáře • 84

  • @dethcx22
    @dethcx22 Před 2 lety +46

    I joined as a junior developer last year to a fintech company, and recently we've been squashing our dependencies just like this. We found that in our bundle, we were adding language support for every language imaginable, however our application atm only supports English; Removing those languages obviously greatly reduced the size for that exported module. We're doing the same for the rest of the application, attempting to optimise as we go; Our old build times for the entire front end was around 40 mins on a 2018 Mac now it's around 40 secs. Still work to do, but we'll get there :)

    • @DavidWoodMusic
      @DavidWoodMusic Před 2 lety +5

      Fellow Fintech engineer here.
      There is a part of me that thinks we work for the same company based on what you just said.

    • @fabhi
      @fabhi Před 2 lety +2

      Yes you do

    • @DavidWoodMusic
      @DavidWoodMusic Před 2 lety +2

      @@fabhi oh shi

    • @nextentrepreneur9288
      @nextentrepreneur9288 Před 2 lety

      Frt too l kk la k ok though yup JJ HH HGH h uhh uh-huh baby you huh he hh huh hh ph hi HGH oh my hh lol no j hh la Bamba kk try hh baggy keep p MGK makeup in you k ok kk bsj man ok

    • @JustATempest
      @JustATempest Před rokem

      @@fabhi hahaha

  • @samuelgunter
    @samuelgunter Před 2 lety +44

    any route that includes the "your-mom" package increases with 4 gb (after gzipping)

  • @pogadev
    @pogadev Před 2 lety +29

    I really appreciate your content! Keep it up! I’m applying a lot of stuff from your videos in my daily job as a Front End engineer

    • @Julia_Berrrlin
      @Julia_Berrrlin Před 2 lety +9

      too true, the only content creator i know who talks about stuff thats intermediate

    • @t3dotgg
      @t3dotgg  Před 2 lety +2

    • @t3dotgg
      @t3dotgg  Před 2 lety +5

      I'm not the only one!!! Jack Herrington is great as well definitely check him out

    • @27sosite73
      @27sosite73 Před 8 měsíci

      @@t3dotgg that is correct

  • @RossPfeiffer
    @RossPfeiffer Před 2 lety +78

    my nextjs isn't big, it just keeps refreshing in an infinite loop

  • @MisterKitKit
    @MisterKitKit Před 2 lety +7

    great video, btw you can press F1 and type "Organize imports" and then your unused imports are removed :)

  • @unknownChungus
    @unknownChungus Před 2 lety +9

    0:16 : That's what she said!

  • @dansteryoo
    @dansteryoo Před 2 lety +6

    this literally helps me shave off so much off my app.. love you theo. keep doing what you're doing. you're literally the only dev on youtube worth their weight in gold..

  • @nexxel
    @nexxel Před 2 lety +7

    Watched this video and used all the tips from it, ended up reducing about 30kb in a next app just by dynamically importing components

  • @sebcuadros
    @sebcuadros Před rokem +2

    Man the visualization is insane. Definitely gonna test this out, thanks 🙏

  • @4ortson
    @4ortson Před 2 lety +10

    mostly when analyzing other's code, i find huge lodash and momentjs 😂

    • @dweblinveltz5035
      @dweblinveltz5035 Před 2 lety +3

      I think the same is true of lodash, but moment for sure has an issue with tree-shaking. Import just one function and you end up getting the entire package. I found a way to solve that a few years ago, but don't remember at the "moment"--
      but in any case, no one should be using moment anymore.

    • @hugoanderkivi
      @hugoanderkivi Před 2 lety +1

      ​@@dweblinveltz5035 date-fns is superior to Momentjs, in my opinion. Simple and easy to use.

    • @evanskwofie2443
      @evanskwofie2443 Před rokem

      My mate used momentjs in a project we worked on, should I be worried?

    • @dweblinveltz5035
      @dweblinveltz5035 Před rokem

      @@evanskwofie2443 It will probably work, but hopefully your mate kept his domain logic separate so you can easily swap it out with a more up-to-date library.

  • @kubre
    @kubre Před 2 lety +6

    Times when dummy thicc is not better

  • @peshutanpavri1599
    @peshutanpavri1599 Před 6 měsíci

    Thank you so much for this, I haven’t done front-end for a while, getting back to this now.
    Your content has been so helpful to me 😊
    I am a bit confused about 1 thing:
    Next.js VS Vite,
    Especially if I have another backed in Java/kotlin,
    Which is something I might use for certain backend projects & I still want a react front-end on the same port

  • @elvis1335
    @elvis1335 Před rokem +1

    i feel personally attacked that this was recommended whilst trimming my nextjs app lol

  • @thomaseckert5691
    @thomaseckert5691 Před 2 lety

    Your timing is perfect. I was literally looking for this info today!

  • @MachineYearning
    @MachineYearning Před 2 lety +6

    Looks like some great opportunities for improvement in this tooling! Better route-based bundle analysis as well as fixing that server stuff.

  • @notthere83
    @notthere83 Před měsícem

    Type imports instead of regular ones resulting in massive reduction - yeah, seen that before.

  • @elliotheath5366
    @elliotheath5366 Před 2 lety +5

    Great upload. Do dynamic imports impact time-to-interactivity?

  • @siva-gy9ks
    @siva-gy9ks Před 2 dny

    Im struct at here
    My first load js size is 96kb
    Im running on aws server using 4gb RAM
    when i load the application at first
    The cpu is hitting near to 90% and memrory is 80%
    The event and compiled time is 12s
    🙏🏻🙏🏻
    Any solution for bringing the percentage of cpu and memory

  • @user-tw4ht4yn2p
    @user-tw4ht4yn2p Před 2 lety +2

    Thank you for Theo, I really appreciate let us know how to analyze bundle size. cuz of it I realize that I used mui for only dateTimePicker but it charged of 800kb bundle size which is bigger than combined of all other modules...! but also I used this dateTimePicker only at my modal component and I tried to use dynamic import. I reduced half of bundle size ( 210kb -> 100kb)
    thank you so much and always feel grateful videos you made

  • @CoryTheSimmons
    @CoryTheSimmons Před 2 lety +2

    Great practical tutorial! Thanks Theo.

  • @Mitsunee_
    @Mitsunee_ Před rokem +1

    This confirmed that I did a good job making an api-connector I use in SSG not leak into the client bundle. Somehow zod snuck in there tho, so that's an investigation waiting to happen.
    Edit: I also just found out about the rule consistent-type-imports from typescript-eslint's eslint-plugin, that can be set up to make sure you use import type wherever possible, which removes a bunch of enums and stuff I never needed from bundles.

  • @josephuwagwu3069
    @josephuwagwu3069 Před 2 lety +3

    Lazy loading, nice one 👍🏿

  • @IainSimmons
    @IainSimmons Před 2 lety +1

    Not gonna lie, when I saw this pop up in my feed I thought it was going to be another Astro video

  • @vishalrahangdale3624
    @vishalrahangdale3624 Před 5 měsíci

    Hello sir please let me know if you need video editor for your video im video editor as well as nextjs developer

  • @primatch777
    @primatch777 Před 2 lety

    Is there anything that can be applied in the same way for just a CRA app?

  • @wandersonsousa1891
    @wandersonsousa1891 Před 2 lety +1

    Thank you for the great work!

  • @brandonflorian9044
    @brandonflorian9044 Před 2 lety

    Perfectly timed release, just when I needed it.

  • @user-lb8to5yr6r
    @user-lb8to5yr6r Před 2 lety +4

    lighthouse showed ~20 performance points for my app. I used next/dynamic to load react-modal and now lighthouse shows 50 points!

  • @navaneeth6157
    @navaneeth6157 Před 2 lety +2

    can you make video on how to handle payments

    • @t3dotgg
      @t3dotgg  Před 2 lety +28

      Step 1: Use Stripe
      Step 2: Profit

  • @doichev-kostia
    @doichev-kostia Před 2 lety

    Theo, can you tell about the error handling? Custom exceptions, catching the errors in prod with tools like Sentry, async errors visualisation, error notifications/pages etc.

  • @Ca-rp7bv
    @Ca-rp7bv Před 2 lety +1

    This is pure gold

  • @yoman9446
    @yoman9446 Před 2 lety

    why use duck duck go? that too on google chrome? that's like putting off fire with fire

  • @mayukhikhan8121
    @mayukhikhan8121 Před 2 lety +2

    Hey, don’t call the Ducky too big! He’s just doing his best.

  • @jagadeeshar9550
    @jagadeeshar9550 Před rokem

    Thanks man!!

  • @jj4l
    @jj4l Před 2 lety

    Ooh upgrade to the SM7-B

  • @noitesdevento
    @noitesdevento Před 8 měsíci

    super useful!

  • @jonathanyngfors3905
    @jonathanyngfors3905 Před rokem

    Really good! Tanks

  • @michalkotlicki4710
    @michalkotlicki4710 Před 2 lety +1

    Theo what do you think about micro frontends? Are they useful?

  • @dastanozgeldi
    @dastanozgeldi Před 2 lety

    any recommendations on storage for create-t3-app?

    • @dastanozgeldi
      @dastanozgeldi Před 2 lety

      a video would actually help to fully move out of supabase

  • @AssFaceNFT
    @AssFaceNFT Před rokem

    Exactly what I was thinking 🤔

  • @JacksonMarshal
    @JacksonMarshal Před 2 lety +1

    Damn, I'm switching to Java spring boot.

  • @MrAhvids
    @MrAhvids Před 2 lety +1

    Such a valuable vid

  • @AndrewTSq
    @AndrewTSq Před rokem

    NextJS - PHP V2.0

  • @david016rock
    @david016rock Před rokem

    That's what she said.

  • @user-pn5wv3nw9o
    @user-pn5wv3nw9o Před 2 lety +1

    How to make next app smaller? Just don't use next lol :D

  • @jessicawentling3231
    @jessicawentling3231 Před 2 lety

    Great video!

  • @krzysztofczva5904
    @krzysztofczva5904 Před 2 lety

    That's whqt she said

  • @mohamedalaa6199
    @mohamedalaa6199 Před rokem

    bro made an amazing video 🙌

  • @byte-master
    @byte-master Před 7 měsíci

    Shahid Kapoor

  • @herosova
    @herosova Před rokem

    use php and get rid of all of this shit

  • @ibrahimmohammed3484
    @ibrahimmohammed3484 Před 2 lety

    nextjs is now something from the past

  • @robolist2277
    @robolist2277 Před 2 lety +1

    hehe first

  • @alexbecar977
    @alexbecar977 Před 2 lety +2

    Make it smaller by not using react in general

  • @altairbueno5637
    @altairbueno5637 Před 2 lety +7

    “Developers who care about performance”. Man, you write JS lol

  • @arpitsatyal8900
    @arpitsatyal8900 Před 2 lety +2

    your videos are too long.

  • @Rene-tu3fc
    @Rene-tu3fc Před 2 lety +1

    "massive 1 megabyte" cries in .jar

  • @parkourbee2
    @parkourbee2 Před 2 lety +2

    Solution: SvelteKit 👀

    • @Ca-rp7bv
      @Ca-rp7bv Před 2 lety +2

      Production ready solutions only ;)

    • @t3dotgg
      @t3dotgg  Před 2 lety +6

      Considering that all the deps in this video were NOT NextJS, I'm sure that switching to SvelteKit will magically make the non-Next code in my app smaller too

  • @quelchx
    @quelchx Před 2 lety

    That's what she said.