bjoluc / next-redux-cookie-wrapper

Sync a subset of your Redux state with cookies in Next.js :cookie: :sparkles:
MIT License
114 stars 4 forks source link

Cannot find module cookie when deploying on vercel #12

Closed MaciejWiatr closed 3 years ago

MaciejWiatr commented 3 years ago

image

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

MaciejWiatr commented 3 years ago

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 commented 3 years ago

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

bjoluc commented 3 years ago

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:

bjoluc commented 3 years ago

:tada: This issue has been resolved in version 1.1.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

bjoluc commented 3 years ago

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