Upgrade MSW to 2.6.6.
| 1
2
 | The operation is insecure.
getWorkerInstance@http://localhost:3000/static/js/vendors-node_modules_msw_lib_browser_index_mjs-node_modules_msw_lib_core_HttpResponse_mjs-nod-8fd840.chunk.js:5736:11
 | 
AI Suggests to put mockServiceWorker.js into /public/myPage/mockServiceWorker.js
| 1
2
3
4
5
6
7
8
 |  url: "/myoage/mockServiceWorker.js",
+
/public/mypage/mockServiceWorker.js
	All Fail!  
	http://localhost:3000/mypage
	http://localhost:3000/mypage/
	http://localhost:3000/myPage/mypage
	http://localhost:3000/myPage/mypage/
 | 
| 1
2
3
4
5
6
7
8
 | url: "mypage/mockServiceWorker.js",
+
/public/mypage/mockServiceWorker.js
	http://localhost:3000/mypage
		Not work!
	http://localhost:3000/mypage/
		Work
		But api still 404
 | 
| 1
2
3
4
5
6
7
 | url: "mypage/mockServiceWorker.js",
+
/public/mockServiceWorker.js
	http://localhost:3000/myPage
		Not work!
	http://localhost:3000/myPage/
		Work
 | 
| 1
2
3
4
5
6
7
8
 | url: "/mypage/mockServiceWorker.js",
+
/public/mockServiceWorker.js
	http://localhost:3000/myPage
		❌
	http://localhost:3000/myPage/
		❌
	Comfirmed url starts '/' would fail!  
 | 
| 1
2
3
4
5
6
7
8
9
 | index.js
url: "mypage/mockServiceWorker.js",
"msw": {"workerDirectory": ["public"]},
+
/public/mypage/mockServiceWorker.js
	http://localhost:3000/mypage
		Not work!
	http://localhost:3000/mypage/
		Work
 | 
| 1
2
3
4
5
6
7
8
9
 | index.js
url: "mypage/mockServiceWorker.js",
"msw": {"workerDirectory": ["public"]},
+
/public/mockServiceWorker.js
	http://localhost:3000/mypage
		Work
	http://localhost:3000/mypage/
		Not work!
 | 
| 1
2
3
4
5
6
7
8
9
10
11
 | index.js
url: "/mockServiceWorker.js",
"msw": {"workerDirectory": ["public"]},
+
/public/mockServiceWorker.js
	http://localhost:3000/
		❌
	http://localhost:3000/mypage
		❌
	http://localhost:3000/mypage/
		❌
 | 
| 1
2
3
4
5
6
7
8
9
 | index.js
url: "mypage/mockServiceWorker.js",
"msw": {"workerDirectory": ["public/mypage"]},
+
/public/mypage/mockServiceWorker.js
	http://localhost:3000/mypage
		❌
	http://localhost:3000/mypage/
		✅
 | 
| 1
2
3
4
5
6
7
 | index.js
url: "mypage/mockServiceWorker.js",
"msw": {"workerDirectory": ["public/mypage/"]},
+
/public/mypage/mockServiceWorker.js
	http://localhost:3000/mypage
	http://localhost:3000/mypage/
 | 
| 1
2
3
4
5
6
7
8
9
10
11
12
13
 | index.js
url: "mockServiceWorker.js",
"msw": {"workerDirectory": ["public/mypage"]},
+  
/public/mypage/mockServiceWorker.js
	http://localhost:3000/mypage  
		❌
	http://localhost:3000/mypage/  
		❌
	http://localhost:3000/mypage/mypage
		✅
	It works when api changed to **/mypage/mypage/api**.  
		✅
 | 
Final Work Version!
URL must be http://localhost:3000/mypage/, the last / is necessary!
| 1
2
3
4
5
 | index.js
url: "mockServiceWorker.js",
"msw": {"workerDirectory": ["public"]},
+  
/public/mockServiceWorker.js
 |