bjoluc/next-redux-cookie-wrapper

Cannot find module cookie when deploying on vercel

MaciejWiatr opened this issue ยท 5 comments

For now i've managed to overcome this issue by explicitly importing cookies module into my _app.js like that:
image
however idk if it's really the best solution, not the cleanest one, that's for sure.

So I'd still like some suggestions, maybe i was doing something wrong

However, I now see that this disables automatic static optimization and make the whole bundle a lot bigger D:

Thanks for reporting this and sorry for ghosting! I don't know what's going on with vercel there; do they build a server-side bundle? I certainly introduced this problem in d9e0315 as a reaction to #8, not meaning to affect server-side behavior.

However, I now see that this disables automatic static optimization and make the whole bundle a lot bigger D:

Two different things here:

  • Automatic static optimization is always disabled when next-redux-cookie-wrapper is in place, since it still uses the old v5 of next-redux-wrapper. #9 is related to that. Hope to build something neat in the next semester break.
  • Bundle size: That's why I tricked Next.js into excluding the server-only cookies library from the bundle using the "eval cheat". It now seems that vercel walks into the same trap. I will need to look for a better solution here, didn't work with vercel yet...

๐ŸŽ‰ This issue has been resolved in version 1.1.4 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

I discovered the browser field in package.json to exclude the cookies library from the client build (and only the client build, hopefully ๐Ÿ˜„). @MaciejWiatr Please try again and feel free to re-open the issue if the new version does not fix the problem!