Skip to content
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

Inline workbox-sw.js in non-WP_DEBUG to eliminate HTTP request #97

Merged
merged 1 commit into from
Oct 29, 2018

Conversation

westonruter
Copy link
Collaborator

Fixes #93.

We can avoid an additional HTTP request for each installation of the service worker by inlining the workbox-sw.js file into the service worker response instead of requesting it via importScript()

But when WP_DEBUG is enabled, then we can continue loading via importScripts so that we can take advantage of the source map.

Copy link
Collaborator

@amedina amedina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@westonruter westonruter merged commit 87e4d60 into master Oct 29, 2018
@westonruter westonruter deleted the update/workbox-loading branch October 29, 2018 21:29
@westonruter westonruter added this to the 0.2 milestone Apr 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write workbox-sw.js directly into service worker instead of using importScript()
2 participants