Next.js Discord

Discord Forum

React DOM seems to be imported twice

Answered
Spinge Bib Sqorpnts posted this in #help-forum
Open in Discord
Avatar
Hello! I am trying to reduce my bundle size, and when I went to check with @next/bundle-analyzer it seems as if ReactDOM is imported twice.

analyze/client.html shows:
Image
Answered by Spinge Bib Sqorpnts
View full answer

11 Replies

Avatar
For context, I'm using PNPM instead of NPM.
I tried reinstalling all packages with PNPM, now retrying with NPM.
Avatar
using npm over pnpm did not resolve the issue
Avatar
It could be different parts of the package, but I don't know much about the internals
Avatar
Spectacled Eider
Maybe it's the two versions of react-dom , one for the app folder and other for the pages folder
Avatar
wdym? I'm using the App router, no single reference to the old Pages router
Avatar
Spectacled Eider
For me when I used the pages folder together with the app folder it appeared two versions but that doesn't seen's to be the your case
Avatar
any idea what it could be?
Avatar
Asian black bear
It is intentional as one is for the client bundle and one for the server bundle.
Avatar
Then why are both included on the client.html analysis file?
Avatar
Answer
Avatar
Spectacled Eider
That happened to me before when I was changing to the app folder