Comments (2)
Well, a hacky way to make it work:
if ('serviceWorker' in navigator) {
const x = 'service-worker.js';
navigator.serviceWorker.register(x)
.then(function(registration) {
console.log('Registration successful, scope is:', registration.scope);
})
.catch(function(error) {
console.log('Service worker registration failed, error:', error);
});
}
The main issue is that the service worker isn't ready yet when parcel doesn't the bundling, because the sw is created based on the files created during bundling. There is no official way to do this.
I've opened an issue with parcel: parcel-bundler/parcel#2080
from parcel-plugin-sw-cache.
Cheers for the quick response. Hopefully, there's a better solution when service workers get more complete native support in parcel bundler.
from parcel-plugin-sw-cache.
Related Issues (20)
- Unable to resolve path for swDest. HOT 1
- Cannot read property 'package' of null HOT 12
- generateSW skipWaiting & clientsClaim HOT 1
- Inject Error – `No files match the pattern` for replace-in-file HOT 3
- Broken w/ parcel-bundler 1.11.0
- Local source for workboxSW HOT 2
- workbox-build needs to be upgraded
- How to pre-process the service worker with Parcel? HOT 1
- How to setup expiration in handlers HOT 1
- Parcel 2 support HOT 1
- Change peer dependency to parcel instead of parcel-bundler HOT 1
- Not caching index.html HOT 2
- Add other file types in globPatterns HOT 2
- Thx. It worked for me: But just chrome, not fireFox, Don't know why HOT 1
- Is workbox BroadcastCacheUpdate supported? HOT 17
- Add documentation about how regexes are getting handled HOT 1
- publicURL issue when using SPA in Firebase. HOT 2
- swDest does not respect swDest from config. HOT 1
- Add support for injectionPointRegexp
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parcel-plugin-sw-cache.