Importing contentful.js bundles browser version into server #1230
-
I'm trying to use contentful.js to pull in data for a blog section within a hydrogen app. However, I'm getting this error:
What I've checked: contentful.js declares two asset in
but hydrogen includes the browser version in the server bundle here Any idea how I can get hydrogen to include the correct dependency asset in the server bundle? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hydrogen's server runtime is based off cloudflare worker enviroment. It acts a browser runtime and not as a server (NodeJS). Have you tried importing the library via this path? |
Beta Was this translation helpful? Give feedback.
-
Thank you, that makes sense. I tried importing |
Beta Was this translation helpful? Give feedback.
Hydrogen's server runtime is based off cloudflare worker enviroment. It acts a browser runtime and not as a server (NodeJS).
Have you tried importing the library via this path?
https://github.com/contentful/contentful.js#troubleshooting