Git Product home page Git Product logo

Comments (8)

qubyte avatar qubyte commented on June 15, 2024

This library is intended to be a thin wrapper around the browser fetch-polyfil first, and isomorphic second. That being said, I'd like to see a reduction to see this behaviour in action. Could you show me how to reproduce this please?

from fetch-ponyfill.

mienaikoe avatar mienaikoe commented on June 15, 2024

I've made a gist:

https://gist.github.com/mienaikoe/adc59f9e72e98c287498318a96998f33

from fetch-ponyfill.

mienaikoe avatar mienaikoe commented on June 15, 2024

my npm dependency list for this is:

"dependencies": {
"es6-promise": "^3.2.1",
"fetch-ponyfill": "^1.0.0"
}

from fetch-ponyfill.

paulmelnikow avatar paulmelnikow commented on June 15, 2024

Are this library's current tests reproducing the problem with the affected version of node-fetch?

from fetch-ponyfill.

mienaikoe avatar mienaikoe commented on June 15, 2024

Tests run fine as they are. In the tests, I tried replacing 'promise' with 'es6-promise', and I got the same error. I believe this is because 'es6-promise' does not replace the global Promise with itself unless you ask it to do so. 'promise' probably does.

In node-fetch, you can see where it sets Fetch.Promise to be whatever global.Promise is. If global promise doesn't exist, then this will remain as undefined.

The problem arises in the setting of "fetch.Promise", which does nothing. if you want to make a difference to node-fetch, you should be using "Fetch.Promise"

from fetch-ponyfill.

paulmelnikow avatar paulmelnikow commented on June 15, 2024

Ah, the problem is in your require. It looks like you need to change

Promise: require('es6-promise')

to

Promise: require('es6-promise').Promise

from fetch-ponyfill.

qubyte avatar qubyte commented on June 15, 2024

@mienaikoe did @paulmelnikow's suggestion help?

from fetch-ponyfill.

mienaikoe avatar mienaikoe commented on June 15, 2024

Yea. Realized that requiring es6-promise just puts it into the global scope. Paul's suggestion actually assigns it. Closing.

from fetch-ponyfill.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.