{"action":"created","issue":{"url":"https://api.github.com/repos/NekR/offline-plugin/issues/62","repository_url":"https://api.github.com/repos/NekR/offline-plugin","labels_url":"https://api.github.com/repos/NekR/offline-plugin/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/NekR/offline-plugin/issues/62/comments","events_url":"https://api.github.com/repos/NekR/offline-plugin/issues/62/events","html_url":"https://github.com/NekR/offline-plugin/issues/62","id":158562944,"number":62,"title":"Suggest add a uninstall function","user":{"login":"ericfong","id":237028,"avatar_url":"https://avatars.githubusercontent.com/u/237028?v=3","gravatar_id":"","url":"https://api.github.com/users/ericfong","html_url":"https://github.com/ericfong","followers_url":"https://api.github.com/users/ericfong/followers","following_url":"https://api.github.com/users/ericfong/following{/other_user}","gists_url":"https://api.github.com/users/ericfong/gists{/gist_id}","starred_url":"https://api.github.com/users/ericfong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericfong/subscriptions","organizations_url":"https://api.github.com/users/ericfong/orgs","repos_url":"https://api.github.com/users/ericfong/repos","events_url":"https://api.github.com/users/ericfong/events{/privacy}","received_events_url":"https://api.github.com/users/ericfong/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/NekR/offline-plugin/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":22,"created_at":"2016-06-05T16:43:20Z","updated_at":"2016-10-26T20:27:34Z","closed_at":null,"body":"The code that I used to uninstall sw\r\n\r\n```\r\n  if ('serviceWorker' in navigator) {\r\n    navigator.serviceWorker.getRegistrations().then(registrations => {\r\n      for (const registration of registrations) {\r\n        registration.unregister()\r\n      }\r\n    })\r\n    caches.keys().then(keyList => {\r\n      return Promise.all(keyList.map(key => {\r\n        return caches.delete(key)\r\n      }))\r\n    })\r\n  }\r\n```"},"comment":{"url":"https://api.github.com/repos/NekR/offline-plugin/issues/comments/256467017","html_url":"https://github.com/NekR/offline-plugin/issues/62#issuecomment-256467017","issue_url":"https://api.github.com/repos/NekR/offline-plugin/issues/62","id":256467017,"user":{"login":"GGAlanSmithee","id":11805103,"avatar_url":"https://avatars.githubusercontent.com/u/11805103?v=3","gravatar_id":"","url":"https://api.github.com/users/GGAlanSmithee","html_url":"https://github.com/GGAlanSmithee","followers_url":"https://api.github.com/users/GGAlanSmithee/followers","following_url":"https://api.github.com/users/GGAlanSmithee/following{/other_user}","gists_url":"https://api.github.com/users/GGAlanSmithee/gists{/gist_id}","starred_url":"https://api.github.com/users/GGAlanSmithee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GGAlanSmithee/subscriptions","organizations_url":"https://api.github.com/users/GGAlanSmithee/orgs","repos_url":"https://api.github.com/users/GGAlanSmithee/repos","events_url":"https://api.github.com/users/GGAlanSmithee/events{/privacy}","received_events_url":"https://api.github.com/users/GGAlanSmithee/received_events","type":"User","site_admin":false},"created_at":"2016-10-26T20:27:33Z","updated_at":"2016-10-26T20:27:33Z","body":"@NekR \r\n\r\nI can reproduce this by:\r\n\r\n1. uninstall sw in `chrome://serviceworker-internals`\r\n2. run app in development mode\r\n    * no sw installed\r\n    * HMR (and other dev-only features) are enabled\r\n3. run app in production mode\r\n    * sw is installed and resources cached\r\n4. run app in development mode\r\n    * app looks for sw\r\n    * cannot find cached content (is removed in a clean script)\r\n    * HMR (and other dev-only features) are disabled\r\n5. uninstall sw and run app in development mode and everything works again\r\n\r\nHere is where it gets weird, because if I (instead of doing point 5) do the following;\r\n\r\n1. clear the cache with `ctrl+f5`\r\n2. close the tab\r\n3. open the app in a new tab (in development mode)\r\n\r\nthen, a cached version of the production build get served, which shows the service worker events and the caching of content (in dev mode which doesn't even install the sw, and without an actual sw file)!, If I then hit `ctrl+f5` again, then the dev build gets served. I can reproduce this over and over.\r\n\r\nThis is super weird, but I cannot see what I am doing wrong. Here's some additional info:\r\n\r\n`\"offline-plugin\": \"^4.3.1\",`\r\n```javascript\r\nnew OfflinePlugin({\r\n    relativePaths: false,\r\n    publicPath: output.publicPath,\r\n\r\n    ServiceWorker: {\r\n        events: true,\r\n        navigateFallbackURL: '/'\r\n    },\r\n\r\n    // No need to cache .htaccess. See http://mxs.is/googmp,\r\n    // this is applied before any match in `caches` section\r\n    excludes: ['.htaccess'],\r\n\r\n    caches: {\r\n        main: ['/', ':rest:'],\r\n\r\n        // All chunks marked as `additional`, loaded after main section\r\n        // and do not prevent SW to install. Change to `optional` if\r\n        // do not want them to be preloaded at all (cached only when first loaded)\r\n        additional: ['*.chunk.js', '/reset.css']\r\n    },\r\n\r\n    externals: ['/', '/reset.css'],\r\n\r\n    // Removes warning for about `additional` section usage\r\n    safeToUseOptionalCaches: true,\r\n\r\n    AppCache: false\r\n})\r\n```\r\n\r\nit builds on the [one from react-boilerplate](https://github.com/mxstbr/react-boilerplate/blob/master/internals/webpack/webpack.prod.babel.js#L72) and is only included in the prod build.\r\n\r\nI have a feeling this error is caused be me running my app through cloud9 ide which servers it over https, but my knowledge of sw is very limited, so might be totally wrong.\r\n\r\nSorry for the lack of info. If I'm able to get some more time, I will try to create a minimal repo for you."}}
{"actor":{"display_login":"GGAlanSmithee"}}