-
-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve support for service workers #1153
Comments
I don't have any direct experience with service workers yet, which is basically why this hasn't been given any specific thought in Encore. I have no idea what would be involved - but I would welcome a proposal of how we think it should work or a PR :). Cheers! |
Same problem here, if I find something I will definitely try to make a PR out of it. Looks like the "recommended" way is Google's Workbox plugin, but on first examination it doesn't fit my use-case. But it might work for other people. |
@codedmonkey I'm one of the maintainers of the Drupal Progressive Web App module, and involved in the 2.x port to Workbox. While it was probably true at some point that placing the service worker anywhere but at the root of the domain was iffy, nowadays, at least in my testing, every major browser works completely fine regardless of where the service worker is served from via the navigator.serviceWorker
.register(drupalSettings.pwa.installPath, {
scope: drupalSettings.path.baseUrl
})
.catch(function (error) {
// Something went wrong.
console.warn('Serviceworker Registration failed', error);
}); I could be mistaken, but I don't think there's any configuration necessary on the server for this? |
Thank you for this suggestion. |
Service workers are a big part of modern web apps and while it's technically possible to create a service worker with Encore, to my knowledge it isn't straightforward.
These hurdles can be overcome with some changes to the Encore configuration, but at this point, it still generates
manifest.json
andentrypoints.json
files for the entry, even though they aren't required and actually collide with the web manifest spec. (why two separate specs use the samemanifest.json
filename is beyond me, but here we are).Since Encore is optimized for building full web applications, having first-party support for service workers would be awesome. The JS ecosystem isn't my biggest strength, so apologies if this is already possible with plugins.
The text was updated successfully, but these errors were encountered: