File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 1- import { asset } from '$app/paths' ;
2-
31export async function init ( ) {
42 if ( import . meta. env . VITE_MSW_ENABLED ) {
53 let { http, passthrough } = await import ( 'msw' ) ;
@@ -12,6 +10,11 @@ export async function init() {
1210 http . get ( 'https://:avatars.githubusercontent.com/u/:id' , passthrough ) ,
1311 http . get ( 'https://code.cdn.mozilla.net/fonts/*' , passthrough ) ,
1412 ) ;
13+
14+ // We need to dynamically import `$app/paths` here to avoid a race condition during app startup,
15+ // resulting in a "ReferenceError: __SVELTEKIT_PAYLOAD__ is not defined" error.
16+ let { asset } = await import ( '$app/paths' ) ;
17+
1518 await worker . start ( {
1619 serviceWorker : { url : asset ( '/mockServiceWorker.js' ) } ,
1720 onUnhandledRequest ( request , print ) {
You can’t perform that action at this time.
0 commit comments