Comments (6)
@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.
Nuxt 3 does not add a fetch polyfill for browsers. Are you doing this by yourself?
from ofetch.
@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.
/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.
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.
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)
- Pick function HOT 1
- Typed API definition HOT 12
- Response does not contain headers HOT 2
- Receiving server-sent events (SSE) HOT 2
- Failed to upload Mega-sized base64 image HOT 1
- Go-like syntax to handle errors HOT 6
- error.statusText & error.statusMessage are undefined after Nuxt build but are set in dev
- deprecate `params` alias for `query` HOT 1
- the HTTP(S) Agent invalid HOT 7
- Can access to typed data in interceptors HOT 2
- Set cookies HOT 11
- error on Response.blob()
- Multipart image upload not working with fetch but with RapidAPI HOT 4
- Missing types in node export HOT 1
- `body` vs `params` option HOT 1
- Inconsistent headers object returned after a retried request
- TS2305: Module 'ofetch' has no exported member FetchOptions HOT 1
- Errors in Interceptors are silently handled
- How to handle errors body HOT 1
- GraphQL Support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ofetch.