-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# v1.0.1 | ||
|
||
In your `sw.js` script, you MUST import `uv.bundle.js` then `uv.config.js` in order. This is because we can no longer hard-code the paths. Ideally, we would import `uv.config.js` then use the config.bundle path in the serviceworker, however the config is dependant on `uv.bundle.js`, which we don't know the location to. | ||
|
||
Old: | ||
```js | ||
importScripts('./uv/uv.sw.js'); | ||
|
||
const sw = new UVServiceWorker(); | ||
|
||
self.addEventListener('fetch', event => | ||
event.respondWith( | ||
sw.fetch(event) | ||
) | ||
); | ||
``` | ||
|
||
New: | ||
```diff | ||
+ importScripts('./uv/uv.bundle.js'); | ||
+ importScripts('./uv/uv.config.js'); | ||
importScripts('./uv/uv.sw.js'); | ||
|
||
const sw = new UVServiceWorker(); | ||
|
||
self.addEventListener('fetch', event => | ||
event.respondWith( | ||
sw.fetch(event) | ||
) | ||
); | ||
``` | ||
|
||
You are still required to specify all paths in `uv.config.js`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters