nulab / backlog-js

Backlog API version 2 client for browser and node.
https://developer.nulab-inc.com/docs/backlog/
33 stars 13 forks source link

fetch is not part of common nodejs runtime #2

Open martinheidegger opened 7 years ago

martinheidegger commented 7 years ago

fetch as used in src/request.ts#L54 is not part of the common nodejs runtime and returns in an error (making it difficult to use the backlog api)

vvatanabe commented 7 years ago

Is it troublesome to use isomorphic-fetch as a dependent module ?

martinheidegger commented 7 years ago

It should be part of the dependencies in the package.json. Using isomorphic-fetch without specified dependencies is not enough.

vvatanabe commented 7 years ago

It's a dilemma. I also thought so in the early stages of development. However, recently fetch has already been implemented in modern browsers. Those browsers do not need the bundled fetch module in the library. So I did not include fetch module in package.json.

martinheidegger commented 7 years ago

A polyfill needs to be available anyhow (since not all browsers implement it) and you could make a separate "no-fetch.js" that can be deeplinked using require('backlog-js/no-fetch').

vvatanabe commented 7 years ago

you could make a separate "no-fetch.js" that can be deeplinked using require('backlog-js/no-fetch').

I see. That is a good idea. In the near future I will try to add that split implementation to this library. Thank you for a good suggestion 😄