hackernews-react-graphql
hackernews-react-graphql copied to clipboard
Add sw-precache, register serviceWorker
Looking at #6, I decided to go ahead and try sw-precache.
The plugin doesn't actually cache anything while webpack in compile-time, but is caching runtime and returning cached assets when the app is offline.
The service worker get's registered only in the index route, but should consider if it would be better to do globally.
I also added NODE_ENV=production flag for the build step, as otherwise the next app was not build with production mode for me locally. I tested this with npm start afterwards, and it included webpack-hmr requests.