diff --git a/packages/workbox/lib/defaults.js b/packages/workbox/lib/defaults.js index 08b33eba..222d6f36 100644 --- a/packages/workbox/lib/defaults.js +++ b/packages/workbox/lib/defaults.js @@ -1,6 +1,6 @@ module.exports = { // General - workboxVersion: '4.0.0-0', + workboxVersion: require('workbox-window/package.json').version, workboxURL: undefined, importScripts: [], autoRegister: true, diff --git a/packages/workbox/package.json b/packages/workbox/package.json index 4b0c717f..3bc6ad40 100644 --- a/packages/workbox/package.json +++ b/packages/workbox/package.json @@ -9,6 +9,6 @@ }, "dependencies": { "@nuxtjs/pwa-utils": "3.0.0-beta.12", - "workbox-window": "4.0.0" + "workbox-window": "^4.0.0" } } diff --git a/test/__snapshots__/pwa.test.js.snap b/test/__snapshots__/pwa.test.js.snap index 01cdf166..9b6bb241 100644 --- a/test/__snapshots__/pwa.test.js.snap +++ b/test/__snapshots__/pwa.test.js.snap @@ -53,7 +53,7 @@ Array [ `; exports[`pwa sw.js 1`] = ` -"importScripts('https://cdn.jsdelivr.net/npm/workbox-cdn@4.0.0-0/workbox/workbox-sw.js', 'custom-sw.js') +"importScripts('https://cdn.jsdelivr.net/npm/workbox-cdn/workbox/workbox-sw.js', 'custom-sw.js') // -------------------------------------------------- // Configure diff --git a/test/pwa.test.js b/test/pwa.test.js index f6322903..540fdb17 100644 --- a/test/pwa.test.js +++ b/test/pwa.test.js @@ -44,6 +44,6 @@ describe('pwa', () => { test('sw.js', async () => { const swContents = await fs.readFile(path.resolve(nuxt.options.generate.dir, 'sw.js'), 'utf-8') - expect(swContents).toMatchSnapshot() + expect(swContents.replace(/@[^/]*/, '')).toMatchSnapshot() }) })