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.

No loader able to handle the import of a .webmanifest file

See original GitHub issue

What 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:closed
  • Created a year ago
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
sergiodxacommented, May 5, 2022

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.

1reaction
bewildergeistcommented, May 5, 2022

@MichaelDeBoey @mcansh: As it says in the MDN docs:

Browsers generally support manifests with other appropriate extensions like .json (Content-Type: application/json)

So it feels reasonable to say:

  1. If you want to just import an asset URL, use an app.webmanifest file
  2. If you also want to import and parse the file to e.g. extract icons, then use a manifest.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 a json() response, which allows for custom Cache-Control headers and the ability to share e.g. icon references across the app. Like @jacob-ebey does here.

Read more comments on GitHub >

github_iconTop 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 >

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