Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

부리미 v0.27 배포 #176

Merged
merged 3 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,5 @@
"vite-plugin-pwa": "^0.16.4",
"vite-tsconfig-paths": "^4.0.7"
},
"types": "module",
"msw": {
"workerDirectory": "public"
}
"types": "module"
}
2 changes: 1 addition & 1 deletion public/mockServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* - Please do NOT serve this file on production.
*/

importScripts('./serviceWorker.js');
importScripts('./sw.js');

const INTEGRITY_CHECKSUM = '3d6b9f06410d179a7f7404d4bf4c3c70';
const activeClientIds = new Set();
Expand Down
3 changes: 0 additions & 3 deletions public/serviceWorker.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ import { worker } from 'src/mocks/browser';

import App from './App';

if ('serviceWorker' in navigator) {
if (process.env.NODE_ENV === 'development') {
navigator.serviceWorker.register('/mockServiceWorker.js');
} else {
navigator.serviceWorker.register('/sw.js');
}
}

if (process.env.NODE_ENV === 'development') {
worker.start();
}
Expand Down