@@ -94,17 +94,7 @@ export function initial_fetch(resource, opts) {
9494 return Promise . resolve ( new Response ( body , init ) ) ;
9595 }
9696
97- const patched_opts = { ...opts } ;
98- if ( DEV ) {
99- // This assigns the __sveltekit_fetch__ flag and makes it non-enumerable
100- Object . defineProperty ( patched_opts , '__sveltekit_fetch__' , {
101- value : true ,
102- writable : true ,
103- configurable : true
104- } ) ;
105- }
106-
107- return window . fetch ( resource , patched_opts ) ;
97+ return DEV ? dev_fetch ( resource , opts ) : window . fetch ( resource , opts ) ;
10898}
10999
110100/**
@@ -130,17 +120,22 @@ export function subsequent_fetch(resource, resolved, opts) {
130120 }
131121 }
132122
133- const patched_opts = { ...opts } ;
134- if ( DEV ) {
135- // This assigns the __sveltekit_fetch__ flag and makes it non-enumerable
136- Object . defineProperty ( patched_opts , '__sveltekit_fetch__' , {
137- value : true ,
138- writable : true ,
139- configurable : true
140- } ) ;
141- }
123+ return DEV ? dev_fetch ( resolved , opts ) : window . fetch ( resolved , opts ) ;
124+ }
142125
143- return window . fetch ( resolved , patched_opts ) ;
126+ /**
127+ * @param {RequestInfo | URL } resource
128+ * @param {RequestInit & Record<string, any> | undefined } opts
129+ */
130+ function dev_fetch ( resource , opts ) {
131+ const patched_opts = { ...opts } ;
132+ // This assigns the __sveltekit_fetch__ flag and makes it non-enumerable
133+ Object . defineProperty ( patched_opts , '__sveltekit_fetch__' , {
134+ value : true ,
135+ writable : true ,
136+ configurable : true
137+ } ) ;
138+ return window . fetch ( resource , patched_opts ) ;
144139}
145140
146141/**
0 commit comments