Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module cookie when deploying on vercel #12

Closed
MaciejWiatr opened this issue Dec 21, 2020 · 5 comments
Closed

Cannot find module cookie when deploying on vercel #12

MaciejWiatr opened this issue Dec 21, 2020 · 5 comments
Labels
bug Something isn't working released

Comments

@MaciejWiatr
Copy link

MaciejWiatr commented Dec 21, 2020

image

The code im having issue with is: https://github.com/MaciejWiatr/Nextagram/tree/develop

@MaciejWiatr
Copy link
Author

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

@MaciejWiatr
Copy link
Author

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

@bjoluc
Copy link
Owner

bjoluc commented Jan 20, 2021

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. Next 9.5 Upgrade #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...

@bjoluc bjoluc added the bug Something isn't working label Jan 20, 2021
@bjoluc bjoluc closed this as completed in 35edd02 Jan 27, 2021
bjoluc pushed a commit that referenced this issue Jan 27, 2021
### [1.1.4](v1.1.3...v1.1.4) (2021-01-27)

### Bug Fixes

* **Build:** Use `browser` field in `package.json` to exclude `cookies` library from client build ([35edd02](35edd02)), closes [#8](#8) [#12](#12)
@bjoluc
Copy link
Owner

bjoluc commented Jan 27, 2021

🎉 This issue has been resolved in version 1.1.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@bjoluc
Copy link
Owner

bjoluc commented Jan 27, 2021

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

No branches or pull requests

2 participants