Commit 7d60d72 1 parent 0e36b89 commit 7d60d72 Copy full SHA for 7d60d72
File tree 5 files changed +15
-1
lines changed
5 files changed +15
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @web/mocks ' : patch
3
+ ---
4
+
5
+ differentiate service worker url between dev and build
Original file line number Diff line number Diff line change 1
1
import './polyfills.js' ;
2
+ import { swPath } from '#sw-path' ;
2
3
import { setupWorker } from 'msw/browser' ;
3
4
import { _registerMockRoutes } from './registerMockRoutes.js' ;
4
5
@@ -7,7 +8,7 @@ const worker = setupWorker();
7
8
const workerPromise = worker
8
9
. start ( {
9
10
serviceWorker : {
10
- url : '/__msw_sw__.js' ,
11
+ url : swPath ,
11
12
} ,
12
13
quiet : true ,
13
14
// See https://github.com/mswjs/msw/discussions/1231#discussioncomment-2729999 if you'd like to warn if there's a unhandled request
Original file line number Diff line number Diff line change 75
75
"@web/dev-server" : " ^0.4.0" ,
76
76
"@web/dev-server-storybook" : " ^2.0.0"
77
77
},
78
+ "imports" : {
79
+ "#sw-path" : {
80
+ "development" : " ./sw-path/dev.js" ,
81
+ "default" : " ./sw-path/build.js"
82
+ }
83
+ },
78
84
"wireit" : {
79
85
"types" : {
80
86
"command" : " tsc --build --pretty" ,
Original file line number Diff line number Diff line change
1
+ export const swPath = '__msw_sw__.js' ;
Original file line number Diff line number Diff line change
1
+ export const swPath = '/__msw_sw__.js' ;
You can’t perform that action at this time.
0 commit comments