VuePress EcosystemVuePress Ecosystem
  • Theme Guidelines
  • theme-default
  • Hope Theme
  • Plume Theme
  • Reco Theme
  • Feature Plugins
  • Markdown Plugins
  • Search Plugins
  • Blog Plugins
  • PWA Plugins
  • Analytics Plugins
  • SEO Plugins
  • Development Plugins
  • Tool Plugins
  • AI Plugins
  • @vuepress/helper
  • English
  • 简体中文
GitHub
  • Theme Guidelines
  • theme-default
  • Hope Theme
  • Plume Theme
  • Reco Theme
  • Feature Plugins
  • Markdown Plugins
  • Search Plugins
  • Blog Plugins
  • PWA Plugins
  • Analytics Plugins
  • SEO Plugins
  • Development Plugins
  • Tool Plugins
  • AI Plugins
  • @vuepress/helper
  • English
  • 简体中文
GitHub
  • PWA
    • Guide
    • Config
  • remove-pwa

remove-pwa

@vuepress/plugin-remove-pwa

This plugin removes any related service worker from your VuePress site, so that users can still get updates if you removed any PWA plugin after enabling it.

Why this plugin is needed if you used PWA plugin once?

PWA plugins like @vuepress/plugin-pwa register service worker to your site, which will cache your site and make it available offline.

However, if you remove pwa plugin, the old service worker will still be there, but they can never get an update because they can never found a new service worker to update to. So users will stay with the old version of your site.

To solve this problem:

  1. A new service worker with empty contents shall be generated in the original place.
  2. The new service worker shall attempt to remove contents that old service worker cached, then it should unregister itself.

Usage

npm i -D @vuepress/plugin-remove-pwa@next
.vuepress/config.ts
import { removePwaPlugin } from '@vuepress/plugin-remove-pwa'

export default {
  plugins: [
    removePwaPlugin({
      // options
    }),
  ],
}

Options

cachePrefix

  • Type: string
  • Default: 'workbox'
  • Details: The cache prefix for the service worker.

swLocation

  • Type: string
  • Default: 'service-worker.js'
  • Details: The location of the old service worker.
Edit this page on GitHub
Last Updated:: 4/12/25, 7:03 PM
Contributors: Mister-Hope
Prev
PWA