You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ideally, we'd use straight globalThis directly in the process polyfill, and in environments which don't reliably provide globalThis we inject the polyfill via the preset configuration.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered:
Could we simply drop the globalThis polyfill since it's extremely unlikely that it's having any effect and it only adds bloat? As far as I can tell this would be a non-breaking change, and could be done as a part of the 1.9.x release train. Thoughts?
I think mainly service worker and web workers lack globalThis instead of self that need support (not sure if it is changed in major of browsers but ~2-3 years ago that added polyfill it was a hard requirement -- unenv also make it possible to run on sw). This article also worth to read if interested.
Re cloudflare and modern runtime presets that we are sure have it, we might try to adopt an aliasing strategy. Make a generic "#unenv/global-this": "polyfill/global-this" and map it to "#unenv/global-this-native" for cloudflare preset wdyt?
Environment
unenv @ main (c4be2cb)
Reproduction
Simple worker like:
Is due to inject for global
process
in Nodeless preset which the Cloudflare preset depends on:unenv/src/presets/nodeless.ts
Line 52 in c4be2cb
This
process
polyfill then pulls in globalThis polyfiil:unenv/src/runtime/polyfill/process.ts
Line 2 in c4be2cb
which then due to suboptimal code generation by ESBuild's inject, results in unnecessary globalThis polyfill in Cloudflare Workers apps:
Describe the bug
Ideally, we'd use straight
globalThis
directly in the process polyfill, and in environments which don't reliably provideglobalThis
we inject the polyfill via the preset configuration.Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: