From 1165fe1c02c823f6d3e9ca9afd6741a6a5d5cc7c Mon Sep 17 00:00:00 2001 From: Jay Giang Date: Thu, 7 Nov 2024 15:49:57 -0800 Subject: [PATCH 1/2] Add service worker removal md --- .../available-scripts/_category_.json | 9 +++++ .../service-worker-removal.md | 37 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 docs/developer-documentation/building-your-application/available-scripts/_category_.json create mode 100644 docs/developer-documentation/building-your-application/service-worker-removal.md diff --git a/docs/developer-documentation/building-your-application/available-scripts/_category_.json b/docs/developer-documentation/building-your-application/available-scripts/_category_.json new file mode 100644 index 0000000..c48cb46 --- /dev/null +++ b/docs/developer-documentation/building-your-application/available-scripts/_category_.json @@ -0,0 +1,9 @@ +{ + "label": "Available Scripts", + "position": 7, + "link": { + "type": "generated-index", + "slug": "developer-documentation/building-your-application/patterns" + } + } + \ No newline at end of file diff --git a/docs/developer-documentation/building-your-application/service-worker-removal.md b/docs/developer-documentation/building-your-application/service-worker-removal.md new file mode 100644 index 0000000..7559386 --- /dev/null +++ b/docs/developer-documentation/building-your-application/service-worker-removal.md @@ -0,0 +1,37 @@ +--- +sidebar_position: 8 +title: Service Worker Removal +--- + +### Removing the Preconfigured Service Worker + +> **Disclaimer:** The service worker in this template is designed to provide offline functionality and improve app performance. Removing it is generally not recommended; however, if needed, follow these steps: + +1. **Uninstall the Service Worker Plugin** + Run the following command to uninstall `vite-plugin-pwa`: + ```bash + npm uninstall vite-plugin-pwa + ``` +2. **Remove Configuration from Vite** + Open `vite.config.js` and remove `vite-plugin-pwa`. + +3. **Remove Service Worker Setup** + In your `src/index.js` file, remove the service worker configurations. + +After these steps, the service worker will be removed from the application. + +### Changes to Remove Service Worker Configuration + +To remove the service worker, make the following changes in your code: + +```diff +- import { VitePWA } from 'vite-plugin-pwa'; +- VitePWA({ +- registerType: 'autoUpdate', +- injectRegister: 'inline', +- }); + +- navigator.serviceWorker.register('/sw.js').then(() => { +- console.log('Service worker registered'); +- }); ++ // Service worker removed from configuration From 02e34040d8211b7aaaa28fb5815885f33ee37838 Mon Sep 17 00:00:00 2001 From: Jay Giang Date: Thu, 7 Nov 2024 15:51:58 -0800 Subject: [PATCH 2/2] Remove test diff display --- .../service-worker-removal.md | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/docs/developer-documentation/building-your-application/service-worker-removal.md b/docs/developer-documentation/building-your-application/service-worker-removal.md index 7559386..5c02cc8 100644 --- a/docs/developer-documentation/building-your-application/service-worker-removal.md +++ b/docs/developer-documentation/building-your-application/service-worker-removal.md @@ -20,18 +20,3 @@ title: Service Worker Removal After these steps, the service worker will be removed from the application. -### Changes to Remove Service Worker Configuration - -To remove the service worker, make the following changes in your code: - -```diff -- import { VitePWA } from 'vite-plugin-pwa'; -- VitePWA({ -- registerType: 'autoUpdate', -- injectRegister: 'inline', -- }); - -- navigator.serviceWorker.register('/sw.js').then(() => { -- console.log('Service worker registered'); -- }); -+ // Service worker removed from configuration