Skip to content

Commit 88cc602

Browse files
gyarasugalvez
authored andcommitted
feat(workbox): option to enable skipWaiting (#80)
Co-authored-by: galvez <jonasgalvez@gmail.com>
1 parent 36e5f01 commit 88cc602

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

packages/workbox/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ function getOptions (moduleOptions) {
6565
routingExtensions: null,
6666
cacheId: process.env.npm_package_name || 'nuxt',
6767
clientsClaim: true,
68+
skipWaiting: true,
6869
globPatterns: ['**/*.{js,css}'],
6970
globDirectory: path.resolve(this.options.buildDir, 'dist'),
7071
modifyUrlPrefix: {
@@ -124,6 +125,7 @@ function addTemplates (options) {
124125
method: i.method || 'GET'
125126
}))),
126127
clientsClaim: options.clientsClaim,
128+
skipWaiting: options.skipWaiting,
127129
wbOptions: {
128130
cacheId: options.cacheId,
129131
directoryIndex: options.directoryIndex,

packages/workbox/templates/sw.template.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ workbox.precaching.precacheAndRoute([], <%= JSON.stringify(options.wbOptions, nu
55
<% if (options.offlinePage) { %>workbox.precaching.precacheAndRoute(['<%= options.offlinePage %>'])<% } %>
66
<% if (options.cachingExtensions) { %><%= options.cachingExtensions %><% } %>
77
<% if (options.clientsClaim) { %>workbox.clientsClaim()<% } %>
8+
<% if (options.skipWaiting) { %>workbox.skipWaiting()<% } %>
89

910
<%
1011
options.runtimeCaching.forEach(r => {

0 commit comments

Comments
 (0)