hardforkio / react-app-template

base repo to create a react app with some extra settings and tools
0 stars 2 forks source link

Remove the service worker #2

Open levino opened 4 years ago

levino commented 4 years ago

Remove the service worker code and all mention of it in the codebase.

~Former version: I hate the service worker for react apps, I only had cache issues. What is your opinion on this @monotv ?~

monotv commented 4 years ago

@Levino I have no opinion on that, never worked with it. But if I had to judge by the docs it is opt-in with Create React App 2 anyways because of the problems you mentioned. They specifically recommend to not enable an offline-first service worker in development because of possible caching issues.

See: https://create-react-app.dev/docs/making-a-progressive-web-app/#offline-first-considerations

levino commented 4 years ago

Out it goes!

levino commented 4 years ago

@jakobkolb Was this project created with react-create-app@^2? Is the service worker not opt in? Did you opt into it? Why?

levino commented 4 years ago

I see. It is off: https://github.com/hardforkio/react-app-template/blob/c974cb96a4a9db60b4ba2c59d26c670aed0f2889/src/index.tsx#L17 We would need to change this to

serviceWorker.register()

to opt-in.

Even if so, I vote to delete the file and all mention of the service worker. It is just noise and dangerous dead code for me.

jakobkolb commented 4 years ago

I didn't know about versions 1 vs 2 of create react app, but since v.2 is the default, I used that. I also didn't opt into the serviceWorker.

levino commented 4 years ago

@jakobkolb see my last comment which basically answered my question.