nutritionix / nutrition-label

Create a FDA-style nutrition label with any nutrition data source (even the Nutritionix API - http://www.nutritionix.com/api)
http://www.nutritionix.com/
MIT License
176 stars 66 forks source link

The JS library uses window object which is not available in an SSR context like Remix #144

Open LeftoversTodayAppAdmin opened 2 months ago

LeftoversTodayAppAdmin commented 2 months ago

Hey folks! I am building an app using Remix which does server side rendering by default and it looks like this library relies on the window object which is only available in client side browser contexts and it fails with the following error when the same page tries to render on the server.

ReferenceError: window is not defined

Is it possible to update the library to remove its reliance on the window object so it can be used for Server Side Rendering which is very common for ecommerce applications where your library will likely get the most use?

Thank you! Shri

majin22 commented 2 months ago

not sure if I can look at this in the near future because i have a lot of other more urgent tasks in the near future