Disable PWA plugin in Vue CLI 3 Disable PWA plugin in Vue CLI 3 vue.js vue.js

Disable PWA plugin in Vue CLI 3


I resolved this by doing the following:

  1. Removing the registerServiceWorker.js file
  2. removing the import of registerServiceWorker.js from main.js.
  3. removing the PWA plugin from the devDependencies in package.json.


Vue enabled a method to disable pwa for certain builds in version 4. Now you can add --skip-plugins pluginname during your build. This one worked for me just fine:

 npx vue-cli-service build --skip-plugins pwa,workbox

Ref: https://cli.vuejs.org/guide/cli-service.html#skipping-plugins


There is an open but accepted proposal to add this to the core functionality: https://github.com/vuejs/vue-cli/issues/3830

EDIT:

Via command line:https://cli.vuejs.org/guide/cli-service.html#skipping-plugins

npx vue-cli-service build --skip-plugins pwa,workbox

Via vue.config.js:

module.exports = {  chainWebpack: config => {    config.plugins.delete('pwa');    config.plugins.delete('workbox');  }}