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.

The images in /dist/assets are not cached

See original GitHub issue

I changed the SVG image in the demo to PNG, and then placed it in /src/assets. This image will not be displayed offline

I tried to write ['*.png'] in includeAssets, it didn’t seem to work

I uploaded the demo code here

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
userquincommented, Nov 15, 2021

@akirarika both are equivalent, the main diference is that with your solution, you sould take care including all assets. includeAssets will add the result on [workbox/injectManifest].additionalManifestEntries instead manipulating [workbox/injectManifest].globPatterns: https://github.com/antfu/vite-plugin-pwa/blob/main/src/assets.ts#L32, https://github.com/antfu/vite-plugin-pwa/blob/main/src/assets.ts#L58 and https://github.com/antfu/vite-plugin-pwa/blob/main/src/assets.ts#L101

0reactions
mykwilliscommented, Mar 7, 2022

Regarding the warning message, I see now my confusion.

This note:

If you configure globPatterns on workbox or injectManifest plugin option, you MUST include all your assets patterns: globPatterns will be used by workbox-build to match files on dist folder. By default, globPatterns will be **.{js,css,html}: workbox will use glob primer

Might be more clear if it said:

If you provide a value for either workbox.globPatterns (when using generateSW strategy) or for injectManifest.globPatterns (when using injectManifest strategy), you MUST include all of…

Sorry for my confusion on that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Guide for Caching and HTTP Cache Headers for Static Content
HTTP cache headers for images and other static content. In almost all cases, static assets like images, JS, and CSS, do not change...
Read more >
using with file-loader, files are not builded if in cache ... - GitHub
While using with file-loader , if output directory does not content assets folder — get those files from cache and put in assets...
Read more >
How to enable browser caching of assets (images/JS/CSS) in ...
I would like the browser to cache these aggressively, so that the majority of pageloads will not re-requests these assets. The default appears...
Read more >
Asset Caching - Expo Documentation
To download and cache the images saved to the local filesystem, use Asset. fromModule(image). downloadAsync() .
Read more >
Assets & caching - Infinum
Application build files in dist directory include: Fingerprinted JS and CSS chunks; Copied assets directory. Individual asset files are NOT ...
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