I currently implement a front-end along with a service worker. As I require several code pieces for my service worker, I opted to use the importScripts function from the standard.
I really don't get why importScripts was added to this standard as modules became part of the ES6 standard about 3 years ago (although still missing in most browsers, if not using a flag).
Can someone elaborate on this? I assume it's related to the error handling and the like...
After some research the bottomline is, that the specification for importScripts was older than for the ES6 modules. In the long run ES6 modules likely will be supported in Service Workers. As of now it's not supported in Chrome Canary yet, although there is ES6 module support for the front-end since version 60.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With