PWA manifest issue
See original GitHub issueDescribe the bug
I have an index.html
that contains a reference to a PWA manifest like <link rel="manifest" href="/manifest.webmanifest" />
. The manifest itself looks like this
{
"name": "App",
"icons": [
{
"src": "icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": "/"
}
When building the project with Vite, it inlines the manifest in the html. I think inlining this alters the behaviour of the manifest, as all relative urls in the manifest are, according to the spec, resolved against the url of the manifest. When this is inlined, the browser does not correctly resolve the start and icon urls because the manifest itself does not have a url anymore. Maybe this should not be inlined at all?
On a second note, the icon is also not included in the assets folder of the build. Is this intended behaviour? I would expect the icon to also be bundled.
Reproduction
Can be found here: https://stackblitz.com/edit/vite-5z2vtb
System Info
System:
OS: macOS 11.4
CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
Memory: 18.61 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 15.0.1 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 7.19.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Browsers:
Brave Browser: 96.1.32.113
Edge: 96.0.1054.43
Firefox: 86.0.1
Safari: 14.1.1
npmPackages:
vite: ^2.6.13 => 2.6.13
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:10 (2 by maintainers)
Top GitHub Comments
I already used that as a solution for now. But the docs state that this is for files that are not referenced in code, or must retain the exact file name, or you don’t want to import them to just get the url. None of these are true in this case.
It would even be preferable to have the icon with a hashed filename in my case.
https://vitejs.dev/guide/assets.html#the-public-directory