ilan-schemoul / meteor-service-worker

An universal service worker for meteor apps
MIT License
137 stars 26 forks source link

Meteor file hash extraction without query string #18

Closed dhamaniasad closed 5 years ago

dhamaniasad commented 6 years ago

In Meteor, the hash of the file bundled JS and CSS files is included in the URL path as http://localhost:3000/{hash}?meteor_js_resource=true, instead of as a query string ?hash={hash}.

I'm not sure if this is the best way to do it, but the previous service worker does not work with Meteor apps I tried using it with, and these changes make it work.

ilan-schemoul commented 5 years ago

Well you're right hash detection on bundled version is different on that the dev version so if you frequently update the server version user has multiple js versions where all but one are useless. This issue should be addressed in the future to optimize cache. But the way you've done it would stop proper caching handling on localhost version (if you just meteor multiple JS files are served with ?hash=[HASH]) so dev will have thousands JS files (as we reload a lot and JS files are split) which would most likely not be a good idea at all. Very interesting concern for the next update thanks a lot to you !