Next.js Discord

Discord Forum

Having issue with production build bundling with webpack as imports are leaking to global tree

Answered
Giant panda posted this in #help-forum
Open in Discord
Giant pandaOP
Having issue with bundling in nextjs. I am using app dir and there is a (dashboard) route group in there. I have a layoput this wrapping every page in the group. The issue I am facing is that even when I am importing a package in route 1, it shows that package in every other page's bundle. This is making the bundle larger and larger on every route added inside the (dashboard) group.

In the below route, I am not importing or using react-datepicker and react-select but they still show in the bundle of that page

1 Reply

Giant pandaOP
Answer