rubyforgood / coral

An upcoming project for Ruby for Good
MIT License
13 stars 10 forks source link

Register service worker #12

Closed bhaibel closed 5 years ago

bhaibel commented 5 years ago

This commit also removes hashes from all webpack bundle filenames. Service workers' filename must be stable rather than include a a cache-busting hash or the browser doesn't treat it as the same SW. While it's possible to configure different webpack entry points to have different output filenames, this appeared difficult to do within webpacker, so we elected to defer that work and maintain velocity. We'll want to restore filename hashes to application.js (though NOT to servie-worker.js) prior to production use.

Type of change

How Has This Been Tested?

When any page is loaded in a service-worker-capable browser, the JavaScript console should log registration of the service worker. Note that you may need to manually un-register the service worker in browser devtools to allow for re-registration in testing.