Comments (10)
Thinking more about it, it won't be possible to implement even runtime pattern matching for main
and additional
cache section since plugin simply do not know what to cache, i.e. it doesn't what means '/post/*'
. To match pattern for assets, we have to do matching agains something, e.g. agains generated assets or URLs requested from page in runtime. Given that, pattern matching at runtime could be implemented only for optional
cache section since it's to cache assets only when they were requested.
from offline-plugin.
Hi and thanks, @tomatau
Yes, externals
should have pattern matching, do not know why it's not there. I will add. By the way, using externals
isn't mandatory, it just prevents warnings from being displayed in console. i.e. if some assets are not listed in externals
and are listed in caches
then they will be added to output anyway, just with warnings to console.
So you can probably use it as is right now and once I update offline-plugin
then warnings will go away.
from offline-plugin.
Thanks for the reply NekR, I've just been listing them in externals anyway and the warnings are good to help catch assets that aren't being generated when you expect them.
from offline-plugin.
Fixed in 2.1.0
. Already on npm
. Thanks for reporting this 👍
from offline-plugin.
Oh, I just realized that you wanted pattern matching for externals inside caches
section too.
This will require pattern matching at runtime, not done yet and probably will be done only in v3.
from offline-plugin.
That makes a lot of sense.
Is there no way main and additional can do a pattern match on activate or install based on the current window path?
from offline-plugin.
They need to know what to download. Say you have 10 posts on a server and
use this pattern '/posts/*'. To match and download them, SW has to know
URLs to all posts on server to download them at install/activate time. In
other words, that is impossible.
What you need is a some custom they to handle it. E.g. make a request to
the server, get list of all posts you want to cache/match and then cache
them.
Unfortunately this isn't possible with this plugin, at least yet.
On Apr 3, 2016 11:46 AM, "Thomas" [email protected] wrote:
That makes a lot of sense.
Is there no way main and additional can do a pattern match on activate or
install based on the current window path?—
You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#26 (comment)
from offline-plugin.
I understand the need for a URL.
What I'm asking about is when an install / activate occurs, you can check against the current page URL (from window.location) and add the URL the cache if it's a match. The URLs can be added to the cache dynamically during these events. It wouldn't need to know them all on every install/activate -- just update the cache when it finds a match. You would only need the location.pathname.
from offline-plugin.
Oh, I see now. Sounds interesting. Let me think about it a bit 👍
from offline-plugin.
Here is possible API design for it: #117
Can you take a look? Would you be okay with it?
from offline-plugin.
Related Issues (20)
- Question - SW caching all assets site-wide HOT 1
- In Angular 9, files inside directories are not being cached
- Ideas for Documentation to Help with Troubleshooting
- Some files missing in cache on SW first load/install HOT 1
- Caching subpath urls
- Caching fails to download assets in Chrome 85 HOT 1
- Issue with default path
- [question] Having Multiple runtime installations
- Problem with Webpack 5.0 HOT 17
- Micro Front-ends structure with single-spa
- Auto update doesn't work
- After removing redux-offline, how do we ensure that client's who have old versions get the latest update?
- `onInstalling` doesn't seem to be called, because `ignoreInstalling` is always true
- offline-plugin does not serve assets from service worker
- Webpack 5 compatibility HOT 3
- The "path" argument must be of type string. Received undefined HOT 4
- Cache Images from AWS S3
- Pass ServiceWorker version to the install events
- Terser Plugin issue while building with webpack-cli HOT 3
- upgrade ejs package | CVE-2022-29078 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from offline-plugin.