backlog-js icon indicating copy to clipboard operation
backlog-js copied to clipboard

fetch is not part of common nodejs runtime

Open martinheidegger opened this issue 8 years ago • 5 comments

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)

martinheidegger avatar Dec 01 '16 04:12 martinheidegger

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

vvatanabe avatar Dec 01 '16 05:12 vvatanabe

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

martinheidegger avatar Dec 01 '16 05:12 martinheidegger

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.

vvatanabe avatar Dec 01 '16 06:12 vvatanabe

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').

martinheidegger avatar Dec 01 '16 11:12 martinheidegger

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 😄

vvatanabe avatar Dec 02 '16 01:12 vvatanabe