Ionic-framework: Service worker in wrong directory

Created on 28 Sep 2016  Â·  2Comments  Â·  Source: ionic-team/ionic-framework

Short description of the problem:

Currently we copy the service worker from src/assets to www/assets. It should be copied to www.

Which Ionic Version? 2.0.0-rc.0

Most helpful comment

yeah i’d just place it in /src directly, because its more “symmtrical” then. index+service-worker are copied into the root(www) the rest is either built etc. and all other stuffs is in assets. otherwise you’d not have the nice resolution of the file paths that you get now even in index.html

if ('serviceWorker' in navigator) {
        navigator.serviceWorker.register('service-worker.js')
          .then(() => console.log('service worker installed'))
          .catch(err => console.log('Error', err));
      }

All 2 comments

Not solved in RC0

yeah i’d just place it in /src directly, because its more “symmtrical” then. index+service-worker are copied into the root(www) the rest is either built etc. and all other stuffs is in assets. otherwise you’d not have the nice resolution of the file paths that you get now even in index.html

if ('serviceWorker' in navigator) {
        navigator.serviceWorker.register('service-worker.js')
          .then(() => console.log('service worker installed'))
          .catch(err => console.log('Error', err));
      }
Was this page helpful?
0 / 5 - 0 ratings

Related issues

gio82 picture gio82  Â·  3Comments

MrBokeh picture MrBokeh  Â·  3Comments

masimplo picture masimplo  Â·  3Comments

brandyscarney picture brandyscarney  Â·  3Comments

giammaleoni picture giammaleoni  Â·  3Comments