No loader able to handle the import of a .webmanifest file
See original GitHub issueWhat version of Remix are you using?
1.2.3
Steps to Reproduce
Create a manifest.webmanifest
file and import it.
Example contents:
{
"icons": [
{ "src": "/icon-192.png", "type": "image/png", "sizes": "192x192" },
{ "src": "/icon-512.png", "type": "image/png", "sizes": "512x512" }
]
}
Then import it:
import manifest from "~/assets/manifest.webmanifest";
Expected Behavior
It will import the file with the url, like mentioned in the docs: https://remix.run/docs/en/v1/api/conventions#asset-url-imports
Actual Behavior
Causes the following error:
✘ [ERROR] No loader is configured for ".webmanifest" files: app/assets/manifest.webmanifest
app/root.tsx:4:21:
4 │ import manifest from "~/assets/manifest.webmanifest";
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build failed with 1 error:
app/root.tsx:4:21: ERROR: No loader is configured for ".webmanifest" files: app/assets/manifest.webmanifest
Issue Analytics
- State:
- Created a year ago
- Comments:14 (11 by maintainers)
Top Results From Across the Web
Can't get route to /manifest.webmanifest to work - Stack Overflow
I am aware that I am loading the /home module at root so I've also tried copying the manifest file into the /home...
Read more >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 Application Manifest - W3C
This specification defines a JSON-based file format that provides developers with a centralized place to put metadata associated with a web ...
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 >PWACompat - the Web App Manifest for all browsers
This means you no longer have to add innumerable, standard and ... PWACompat will fetch your manifest file and do the work needed...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Since the .webmanifest file is a static file, any URL inside it would also be static, so I think importing it should give your a URL instead of the content, if you want to preload the icons you can know the URLs because they are static anyway.
@MichaelDeBoey @mcansh: As it says in the MDN docs:
So it feels reasonable to say:
app.webmanifest
filemanifest.json
file…which the #3081 PR (with Logan’s recent update) would support.
(With the caveat that I haven’t empirically tested whether “browsers generally support” actually means that all current browsers support JSON manifests, but I assume so).
And the 3rd option would be to create e.g. a
app[.]webmanifest.js
route file that returns ajson()
response, which allows for customCache-Control
headers and the ability to share e.g. icon references across the app. Like @jacob-ebey does here.