question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PWA manifest issue

See original GitHub issue

Describe 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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:9
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
subhero24commented, Dec 4, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add a web app manifest
The web app manifest is a simple JSON file that tells the browser about your web application and how it should behave when...
Read more >
Web app manifests - MDN Web Docs - Mozilla
Chrome Edge display Full support. Chrome39. Toggle history Full support. Edge7... display_override. Experimental Full support. Chrome89. Toggle history Full support. Edge8... icons Full support. Chrome39. Toggle...
Read more >
Web Application Manifest - W3C
A application manifest is a [ JSON ] document that contains startup parameters and application defaults for when a web application is launched....
Read more >
Use a Web App Manifest to integrate a Progressive Web App ...
A Web App Manifest of a website governs how your Progressive Web App (PWA) looks and behaves when installed on a device.
Read more >
Issues · arthurbergmz/webpack-pwa-manifest - GitHub
Progressive Web App Manifest Generator for Webpack, with auto icon resizing and fingerprinting support. - Issues · arthurbergmz/webpack-pwa-manifest.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found