feat: Add support for browser
ivarconr opened this issue · 1 comments
ivarconr commented
We just changed to using node-fetch, and this is already part of the main branch.
I would not have the SDK depend directly on isomorphic-fetch
, but I am willing to consider a browser specific entry for the browser in the package.json
.
The browser entry needs to do a couple of things:
- change the backup-handler to use localstorage instead of file based storage.
- create a specific "request" module for the browser context (e.g. http(s) agents does not make sense in the browser, and fetch is available in the global scope)
We should also consider adding an "exports" field if we end up with a "browser" field.
- https://nodejs.org/api/packages.html#packages_conditional_exports
- https://webpack.js.org/guides/package-exports
Would love some inital feedback on whether this is a good idea.
ivarconr commented
We open sources the proxy which add support for the browser. https://github.com/Unleash/unleash-proxy