bemusic / bemuse

⬤▗▚▚▚ Web-based online rhythm action game. Based on HTML5 technologies, React, Redux and Pixi.js.
https://bemuse.ninja/
GNU Affero General Public License v3.0
1.15k stars 147 forks source link

:building_construction: Remove service-worker hack #525

Closed resir014 closed 5 years ago

resir014 commented 5 years ago

Motivation

We used some kinda of hack to get the service worker URL to register it, but we can actually do it with serviceworker-webpack-plugin to be able to load up our custom service worker without having to rewrite everything in Workbox.

So we can keep our existing service worker, but to include it, we can simply do this:

- import workerPath from 'bemuse/hacks/service-worker-url/index.loader.js!serviceworker-loader!./service-worker.js'
+ import serviceWorkerRuntime from 'serviceworker-webpack-plugin/lib/runtime'

Things to note

codecov-io commented 5 years ago

Codecov Report

Merging #525 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #525   +/-   ##
=======================================
  Coverage   81.38%   81.38%           
=======================================
  Files         153      153           
  Lines        4619     4619           
  Branches       68       68           
=======================================
  Hits         3759     3759           
  Misses        842      842           
  Partials       18       18

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 71b9091...56bc60c. Read the comment docs.

resir014 commented 5 years ago

We can probably try and follow what create-react-app did to register/unregister our service worker, here: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template-typescript/src/serviceWorker.ts

resir014 commented 5 years ago

@dtinth Ah yeah! We can give this a try, then at the release after this we can experiment with Workbox more. I tried fiddling with Workbox at one point but I didn't go far. 😅

I'll get this merged later today.