diff --git a/lib/internal/bootstrap/web/exposed-window-or-worker.js b/lib/internal/bootstrap/web/exposed-window-or-worker.js index 2459bee85bb8b01..a80581195e62a02 100644 --- a/lib/internal/bootstrap/web/exposed-window-or-worker.js +++ b/lib/internal/bootstrap/web/exposed-window-or-worker.js @@ -59,27 +59,16 @@ installObjectURLMethods(); { // https://fetch.spec.whatwg.org/#fetch-method - function set(value) { - ObjectDefineProperty(globalThis, 'fetch', { - __proto__: null, - writable: true, - value, - }); - } ObjectDefineProperty(globalThis, 'fetch', { __proto__: null, configurable: true, enumerable: true, - set, - get() { - function fetch(input, init = undefined) { - // Loading undici alone lead to promises which breaks lots of tests so we - // have to load it really lazily for now. - const { fetch: impl } = require('internal/deps/undici/undici'); - return impl(input, init); - } - set(fetch); - return fetch; + writable: true, + value: function fetch(input, init = undefined) { // eslint-disable-line func-name-matching + // Loading undici alone lead to promises which breaks lots of tests so we + // have to load it really lazily for now. + const { fetch: impl } = require('internal/deps/undici/undici'); + return impl(input, init); }, }); }