I'm having some issues with caching my files using the default service worker that comes with VueCLI 3. I would prefer to just use the default browser caching mechanism, but can't seem to disable the PWA plugin as its not in the vue.config.js file. Passing a blank object to the pwa option doesn't work either as the object is merged and not overwritten. 
            Asked
            
        
        
            Active
            
        
            Viewed 1.3k times
        
    24
            
            
         
    
    
        Justin Kahn
        
- 1,311
- 2
- 11
- 16
3 Answers
46
            I resolved this by doing the following:
- Removing the registerServiceWorker.jsfile
- removing the import of registerServiceWorker.jsfrommain.js.
- removing the PWAplugin from thedevDependenciesinpackage.json.
 
    
    
        Justin Kahn
        
- 1,311
- 2
- 11
- 16
- 
                    2I found that I also had to remove the `manifest.json` file, usually located in the /public directory. – Chase Nov 19 '18 at 19:19
- 
                    Hello, after following this three step, the service worker cache just won't go away, any hint on how to blow that away on the client side? – Lulu Cheng Mar 04 '21 at 04:10
14
            
            
        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
 
    
    
        chickens
        
- 19,976
- 6
- 58
- 55
9
            
            
        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');
  }
}
 
    