-
SummaryHello, I am trying to fetch on current user data for some logic in nextjs middleware by writing following code-
I am getting the warning, when I try to build on productions. Here is complete warning- Additional information1. I do not change any configuration on next config.
2. After initializing app, I just this middleware.
"next": "14.2.13",
"react": "^18",
"react-dom": "^18", Example |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
I think the problem might be: //Navigation
import { AdminNavs, ModeratorNavs } from './Components/Sidebar/data'; Which in turn imports a lot of You should refactor so that, AdminNavs, and ModeratorNavs, do not reference the icons, and make another file where you map over AdminNavs, and ModeratorNavs, assigning the icons, and export the result, so that the middleware file does not see the icons. |
Beta Was this translation helpful? Give feedback.
I think the problem might be:
Which in turn imports a lot of
react-icons
and stuff, making the middleware file size very large.You should refactor so that, AdminNavs, and ModeratorNavs, do not reference the icons, and make another file where you map over AdminNavs, and ModeratorNavs, assigning the icons, and export the result, so that the middleware file does not see the icons.