cache bower components in root folder #343
Comments
In general, I'd recommend serving your
I'm not sure why that wouldn't work for you—are you sure that you're properly hosting the Once you get that part solved, the only question is whether Finally, if there are any specific errors logged in your browser's JS console related to failures to download files that should be precached, it would be great to pass those along as well. |
I am using angular 1 and I have bower components in the project root.
There is app folder that has the application content.
If I register service-worker in app folder, I cannot cache bower components and then app does not work offline.
If I register service worker outside of app folder, index.html which is in app folder, is never able to find path of servie-worker.js which is outside of app folder, in the root directory.
I have tried this in index.html:
if( 'serviceWorker' in navigator ) {
navigator.serviceWorker
.register( '../service-worker.js' , { scope : ' ' } )
.then( function( ) {
console.log('Congratulations!!Service Worker Registered');
})
.catch( function( err) {
console.log(
Aagh! Some kind of Error :- ${err}
);});
} else {
console.log("SW NOT SUPPORTED");
//still not supported
}
But I only get 404.
I have also tried using absolute path i.e
.register( '/service-worker.js' , { scope : ' ' } )
Also, I tried moving the folder, bower_components to inside app folder but that made no difference at all
The text was updated successfully, but these errors were encountered: