Skip to content

Option to turn off PWA generation #3830

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

Closed
holtwick opened this issue Apr 17, 2019 · 8 comments · Fixed by #4448
Closed

Option to turn off PWA generation #3830

holtwick opened this issue Apr 17, 2019 · 8 comments · Fixed by #4448
Assignees
Labels
feature request has PR intend to implement The team has the intention to implement this feature at some point. Contribution is also welcome. scope: pwa

Comments

@holtwick
Copy link

What problem does this feature solve?

If building for multiple targets, some of them might not support PWA. It would be great to have an option to turn off the functionality

What does the proposed API look like?

Currently the only way is to use a env var VUE_CLI_BUILD_TARGET different to app: https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-plugin-pwa/index.js#L4

This line could e.g. be changed to:

if (target && target !== 'app' || options.pwa.off === true) {
      return
}
@LinusBorg
Copy link
Member

LinusBorg commented Apr 17, 2019

If building for multiple targets, some of them might not support PWA. It would be great to have an option to turn off the functionality

What targets are you referring to? Why would this option be helpful, what problem did you encounter that it would solve? Or what improvement does it bring?

AFAIK, if a plattform / browser doesn't support Service Workers, it's simply skipped.

@holtwick
Copy link
Author

I am currently developing the following app for multiple targets: https://collect-app.com/

Especially for iOS and macOS I distribute the built HTML/CSS/JS inside of the app package I put on the respective app stores. WKWebView (the OS's native web view) is used and it supports PWA. But in this scenario it doesn't make much sense, since the access is instant and always "online" (at least as seen from the app itself). Therefore a service-worker is contra productive, because this extra step is not required.

For Windows and web browsers instead PWA makes sense. See http://desktop.collect-app.com/ and https://mobile.collect-app.com/ as examples (work in progress).

@holtwick
Copy link
Author

After looking closer at it, I have to agree, that by just not registering the service-worker the whole PWA functionality can be avoided. I would still like to avoid this step via config instead of post processing and deleting the superfluous files. But indeed this feature is not very urgent.

@sbyps
Copy link

sbyps commented May 24, 2019

when npm add @vue/cli-plugin-pwa into dependencies, but dont configure it in vue.config.js( or config like pwa: {})
finally, the build bundle would build serviceWorker.js/robots.txt/manifest.json, these files should avoid building
i dont register service-worker in main.js, and built files would include serviceworker files
@LinusBorg

@nosera
Copy link

nosera commented Jun 17, 2019

I need the same functionality for same reason. some of my build targets do not need a service worker(because they are in a local server anyway), I'm afraid it can cause buggy behaviour. I dont want to have it, i dont want to think about it. This is not just me : https://stackoverflow.com/questions/52800904/disable-pwa-plugin-in-vue-cli-3

@LinusBorg LinusBorg self-assigned this Jun 17, 2019
@LinusBorg LinusBorg added the intend to implement The team has the intention to implement this feature at some point. Contribution is also welcome. label Jun 17, 2019
@LinusBorg
Copy link
Member

I think this makes sense. I'll do make a PR.

@camiant
Copy link

camiant commented Aug 14, 2019

temporary workaround

https://stackoverflow.com/a/48188540

LinusBorg added a commit that referenced this issue Aug 16, 2019
Allow skipping of plugins  from command line

close #4262
close #3830
@LinusBorg LinusBorg mentioned this issue Aug 16, 2019
9 tasks
haoqunjiang pushed a commit that referenced this issue Aug 21, 2019
Allow skipping of plugins  from command line

close #4262
close #3830
haoqunjiang pushed a commit that referenced this issue Aug 21, 2019
Allow skipping of plugins  from command line

close #4262
close #3830

(cherry picked from commit fba2ad0)
@zzx0106
Copy link

zzx0106 commented Sep 3, 2019

config.plugins.delete('pwa');
config.plugins.delete('workbox');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request has PR intend to implement The team has the intention to implement this feature at some point. Contribution is also welcome. scope: pwa
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants