@nuxtjs/workbox
Advanced tools
Comparing version
@@ -6,2 +6,19 @@ # Change Log | ||
# [3.0.0-beta.11](https://github.com/nuxt-community/pwa-module/compare/v3.0.0-beta.10...v3.0.0-beta.11) (2019-03-05) | ||
### Bug Fixes | ||
* **workbox:** always prepend routerBase to swURL ([d3a52b6](https://github.com/nuxt-community/pwa-module/commit/d3a52b6)), closes [#157](https://github.com/nuxt-community/pwa-module/issues/157) | ||
### Features | ||
* **workbox:** allow cache names to be configured ([#154](https://github.com/nuxt-community/pwa-module/issues/154)) ([2d7ed53](https://github.com/nuxt-community/pwa-module/commit/2d7ed53)) | ||
* **workbox:** workbox-window support ([2e356d0](https://github.com/nuxt-community/pwa-module/commit/2e356d0)) | ||
# [3.0.0-beta.10](https://github.com/nuxt-community/pwa-module/compare/v3.0.0-beta.9...v3.0.0-beta.10) (2019-02-27) | ||
@@ -8,0 +25,0 @@ |
@@ -34,5 +34,3 @@ const path = require('path') | ||
// swURL | ||
if (!options.swURL) { | ||
options.swURL = joinUrl(options.routerBase, 'sw.js') | ||
} | ||
options.swURL = joinUrl(options.routerBase, options.swURL || 'sw.js') | ||
@@ -39,0 +37,0 @@ // swScope |
{ | ||
"name": "@nuxtjs/workbox", | ||
"version": "3.0.0-beta.10", | ||
"version": "3.0.0-beta.11", | ||
"license": "MIT", | ||
@@ -11,5 +11,6 @@ "main": "lib/module.js", | ||
"dependencies": { | ||
"@nuxtjs/pwa-utils": "3.0.0-beta.10" | ||
"@nuxtjs/pwa-utils": "3.0.0-beta.11", | ||
"workbox-window": "4.0.0" | ||
}, | ||
"gitHead": "c8b83d25120175f50fd9a6ab17700e76b85039ba" | ||
"gitHead": "6dfdf473b0f89e6eca8716b93c98f8b39ba01800" | ||
} |
@@ -12,2 +12,7 @@ importScripts(<%= [options.workboxURL, ...options.importScripts].map((i) => `'${i}'`).join(', ') %>) | ||
<% if (options.cacheNames) {%> | ||
// Set workbox cache names | ||
workbox.core.setCacheNameDetails(<%= JSON.stringify(options.cacheNames, null, 2) %>) | ||
<% } %> | ||
<% if (options.clientsClaim) { %> | ||
@@ -14,0 +19,0 @@ // Start controlling any existing clients as soon as it activates |
@@ -1,9 +0,17 @@ | ||
if ('serviceWorker' in navigator) { | ||
navigator.serviceWorker.register('<%= options.swURL %>', { | ||
import { Workbox } from 'workbox-window/build/workbox-window.<%= options.dev ? 'dev' : 'prod' %>.mjs' | ||
export default async function(ctx, inject) { | ||
const workbox = new Workbox('<%= options.swURL %>', { | ||
scope: '<%= options.swScope %>' | ||
}).then(function(registration) { | ||
window.$sw = registration | ||
}).catch(function(error) { | ||
console.error('Service worker registration failed:', error) | ||
}) | ||
// Inject as $workbox | ||
inject('workbox', workbox) | ||
if (!'serviceWorker' in navigator) { | ||
workbox._unsupported = true | ||
return // Unsupported browser! | ||
} | ||
workbox.register() | ||
} |
14814
6.9%244
2.52%2
100%+ Added
+ Added
+ Added
+ Added
- Removed