Skip to content
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

[PWA] What's the actual use-case for the pwa-plugin? #3006

Closed
alexandernst opened this issue Nov 25, 2018 · 6 comments
Closed

[PWA] What's the actual use-case for the pwa-plugin? #3006

alexandernst opened this issue Nov 25, 2018 · 6 comments

Comments

@alexandernst
Copy link

Version

3.1.1

Reproduction link

Node and OS info

Node 10.x / yarn 1.7.0 / Alpine 3.8

Steps to reproduce

I spent some time tweaking the pwa section in my vue.config.js. Then I ran vue build, expecting the PWA plugin to generate a manifest.json, but I was surprised to see my old (and empty) manifest.json from the public folder just copied to the dist folder.

Then I spent some more time looking at documentation and issues in both vue-cli and @vue/pwa repos, and I couldn't find a real reason about what's the exact purpose of the pwa section in the vue.config.js file.

If the manifest.json is not generated from the content of the pwa section in my vue.config.js, then what's the point in having that section at all?

What is expected?

vue build should create a manifest.json file based on the config in vue.config.js

What is actually happening?

Nothing.

@LinusBorg
Copy link
Member

The section is to set options for the workbox plugin (amongst other things), which does handle the whole ServiceWorker setup, which is really the meat of any PWA.

The other options are used to define values to be set on meta tags in index.html by a small webpack plugin that the cli-plugin-pwa adds to the webpack config.

While a few of those values (most prominently the themeColor, probably) could be synchronized programmatically between these two spots, there's not really much to generate for the manifest.json. The file can just as well be edited by hand.

@alexandernst
Copy link
Author

Check my other open issue (#3007). If that get's implemented it would totally make sense to generate the manifest.json as it would be way less prone to have all the images in one place and then let Vue generate the index, the manifest and so on with the correct paths to each image.

Also have a look at how https://github.com/arthurbergmz/webpack-pwa-manifest handles the images stuff, it's a very clean design.

@lululeon
Copy link

@alexandernst thanks for asking and @LinusBorg thanks for clarifying. The fact that the PWA plugin has all these settings that map so nicely to a PWA manifest file, AND that it (or something else) auto-injects a link for manifest.json into the index.html template, led me to believe that:

  • public/manifest.json can be deleted and the build will magically regenerate it
  • public/manifest.json will be injected with settings from the PWA plugin setup in vue.config.js
  • the build process will complain and alert you if manifest.json is missing for whatever reason or cannot be populated with your settings in the PWA plugin.

I've finally realised that none of these things are true, lol.

@LinusBorg
Copy link
Member

Docs could probably be improved, but that's generally on the roadmap. I'll close this issue since it's not a bug.

If you want to open a feature request to handle manifest.json in a different way, open a new issue for it and describe what it should do, exactly.

PRs would also be welcome.

@alexandernst
Copy link
Author

@LinusBorg instead of closing this issue, can we just convert it to a feature request? It's already well described.

@haoqunjiang
Copy link
Member

Implemented in #2981

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants