Giter VIP home page Giter VIP logo

Comments (6)

peteromano avatar peteromano commented on August 10, 2024 1

@pi0 I'm not adding a polyfill, im referring to the globalThis polyfill (or shim?), which is right in the ohmyfetch codebase, and that's cool, but one place uses the globalThis shim, but another place doesn't:

This line ends up in the nuxt3 build: https://github.com/unjs/ohmyfetch/blob/4b74e45f9989a993e725e7fe4d2e098442e457f1/src/undici.ts#L7

Browsers that dont support globalThis will just fail on that. But this: https://github.com/unjs/ohmyfetch/blob/4b74e45f9989a993e725e7fe4d2e098442e457f1/src/index.ts#L6-L14 uses the polyfill/shim.

So should the following also use the polyfill (basically _globalThis vs globalThis; and move the shim to some shared util file)? https://github.com/unjs/ohmyfetch/blob/4b74e45f9989a993e725e7fe4d2e098442e457f1/src/undici.ts#L7

from ofetch.

pi0 avatar pi0 commented on August 10, 2024

Nuxt 3 does not add a fetch polyfill for browsers. Are you doing this by yourself?

from ofetch.

peteromano avatar peteromano commented on August 10, 2024

@pi0 would be a nice, simple fix (i imagine) that would open up a few more supported browsers.

If this gets cleared, and my app still needs other polyfills, then thats a different story, but currently this is a fixable issue that blocks asserting which browsers work/need other polyfills, etc.

from ofetch.

pi0 avatar pi0 commented on August 10, 2024

/undici and /node subpath exports are only for Node.js and SSR, I'm afraid using fallabck globalThis refs there wouldn't solve safari issue neither needed for Node >= 12.

A simple reproduction and excat safari version would be helpful.

from ofetch.

peteromano avatar peteromano commented on August 10, 2024

I was gonna say, it might not even necessarily be that the polyfill is needed, but that that part of the code shouldn't be part of the client build in general (maybe that's the issue?) The undici path is leaking into the client build but shouldnt be?

Maybe a boilerplate stackblitz of nuxt3 would repro the issue..

Safari 11.1.2

It's not urgent, but like I said, it would cool for nuxt and my app to possibly be able to work on a few other browsers if this issue gets fixed; who konws, maybe this is the only issue on this safari version and everything ends up working fine.

from ofetch.

pi0 avatar pi0 commented on August 10, 2024

Hi. Sorry this issue is stalled. I believe with latest versions, we strictly use polyfills from node-fetch-natvie but please ping me to reopen if still have issues.

from ofetch.

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.