GoogleChrome / workbox

📦 Workbox: JavaScript libraries for Progressive Web Apps
https://developers.google.com/web/tools/workbox/
MIT License
12.35k stars 816 forks source link

Can you use the workbox-webpack-plugin to generate a manifest? #1038

Closed johnnyreilly closed 6 years ago

johnnyreilly commented 6 years ago

Library Affected: workbox-webpack-plugin

Browser & Platform: "webpack*

Issue or Feature Request Description: Hello! I am really enjoying using workbox - thanks so much for making it! I thought I'd take the PWA I've been building ( https://reactspike.azurewebsites.net/ ) and see what Lighthouse thought of it.

Long story short: it was sad my app lacked a manifest. So I set about seeing if I could get workbox to generate a manifest when working with the webpack plugin. I've rather drawn a blank despite the docs here:

https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-build

Is this possible?

jeffposnick commented 6 years ago

Hello @johnnyreilly—Thanks for your continued feedback!

My personal opinion is that generating a Web App manifest is outside the scope of the Workbox project. There are a number of web apps that can generate manifests as one-offs, like

as well as Webpack plugins that can generate manifests for you as part of your build:

I don't know that Workbox has much to add to that space.

johnnyreilly commented 6 years ago

Hey @jeffposnick,

Thanks for responding - I really appreciate it. I'm actually a little puzzled when you say " generating a Web App manifest is outside the scope of the Workbox project". It looks like it does do this if you're using workbox build as described here:

https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-build

Generate a manifest file. This is useful if you want to read in the urls and revision details via an import script or ES2015 module import. See generateFileManifest().

Is this not the same thing? Forgive me if I've got the wrong end of the stick.

Thanks for sharing the links - I'll take a look at them.

In terms of what's in and out of scope for workbox, I think I may have misunderstood workbox's purpose. In my head it's "make PWAs easier to get up and running". From what you've said, it sounds like "make ServiceWorkers easier to get up and running". Is that a reasonable inference to draw?

Thanks again for all your hard work - I am loving what workbox is letting me get done. 👏🌻

jeffposnick commented 6 years ago

Hey @johnnyreilly—Sorry, yes, that's a case of overloading the term "manifest".

There's a distinction between a "precache manifest", which is the list of URLs + revision information that workbox-build generates, and which configures how precaching works, and the "web app manifest" that provides metadata for your web application.

The term "precache manifest" really only has meaning within the context of the Workbox project, while "web app manifests" are a standard thing that exists on the web, and there are multiple tools that already exist independent of Workbox that can help you accomplish what you're asking about.

johnnyreilly commented 6 years ago

Ah - thanks so much for clarifying! For what it's worth, it could be worth being explicit about which type of manifest is being discussed in the docs. Particularly given that "web app manifests" are something that users of workbox are likely to be explicitly interested in.

If you're curious as to what got me into it in the first place, I installed Lighthouse today to see how my pwa measured up. Answer? Marked down due to lack of manifest! I predict others may follow a similar trajectory 😉

gauntface commented 6 years ago

Just checked the new docs for precache and I explicitly call out what a "precache manifest" is and us that term throughout.

AlexBorsody commented 5 years ago

Had the same question and had to come here to clarify. So still not clear in the docs.