Next.js Discord

Discord Forum

Should node_modules exist in client-side JS?

Unanswered
Griffon Nivernais posted this in #help-forum
Open in Discord
Griffon NivernaisOP
Using @next/bundle-analyzer to find out how to optimise high initial load JS, and I see node_modules included for some reason. Does this mean it gets shipped to the client, and if this should be happening?

6 Replies

Griffon NivernaisOP
Hmm, I see.
I did try to reduce the amount of initial load JS but it's proven tricky. Things like Sentry aren't really able to be dynamically imported for some reason. I'll give it another try and see if I can exclude it from the client side.
nextjs isn't the best for initial js 😭
dynamic import seems to just prevent ssr and not change bundle from my experience
Griffon NivernaisOP
I'll keep that in mind, thank you still!