Constructor-io / constructorio-client-javascript

Constructor.io JavaScript client for web applications
https://constructor.io
MIT License
16 stars 5 forks source link

Get Rid of `fetch-ponyfill` #326

Open bertybot opened 1 month ago

bertybot commented 1 month ago

The fetch-ponyfill causes me so many problems when developing with this package since it basically forces you to install node-fetch even if you don't need it. Making this package impossible to use in any JS environment besides node. Which is crazy because this package isn't even supposed to be used on node.

The fetch-ponyfill causes so much frustration and it's not even needed. Modern browsers and the LTS version of node include native-fetch. People who need the polyfill can pass it in the params, instead of forcing us all to install node-fetch

esezen commented 1 month ago

Hey @bertybot , thanks for your recommendation about making the library better. Removing fetch-ponyfill dependency is something we talked about in the past internally but it hasn’t been acted upon yet. We agree it would be nice to remove this dependency considering all modern browsers support native fetch today. We are going to do some research and testing to ensure full backwards compatibility for different environments (browse, React Native etc.) but I wanted to let you know we are actively looking into this and planning to remove fetch-ponyfill.

You also mentioned

Making this package impossible to use in any JS environment besides node. Which is crazy because this package isn’t even supposed to be used on node.

Do you mind explaining what kind of problems you ran into? This library is being used in many Javascript projects at the moment without any problems and it’s meant specifically for non-Node environments like you mentioned. I would like to understand what kind of problems you ran into to make sure we can support you better.

bertybot commented 1 month ago

Do you mind explaining what kind of problems you ran into? This library is being used in many Javascript projects at the moment without any problems and it’s meant specifically for non-Node environments like you mentioned. I would like to understand what kind of problems you ran into to make sure we can support you better.

Ill get a repro but, when using Vite as a Bundler it will try to resolve node-fetch when bundling and then throw a hissy fit because that package uses native node only modules and you are trying to make a browser package.