diff --git a/docs/modules/workbox.md b/docs/modules/workbox.md index d0ee281e..62fc541c 100644 --- a/docs/modules/workbox.md +++ b/docs/modules/workbox.md @@ -67,7 +67,7 @@ It is recommanded to test workbox using `nuxt build`/`nuxt start`. You can enabl ### `workboxExtensions` -(String) Loads and inserts the contents of the specified file path into the service worker script before any call to `precacheAndRoute`. You may add as many extra calls as you want to this file. +(String|String[]) Loads and inserts the contents of the specified file path into the service worker script before any call to `precacheAndRoute`. You may add as many extra calls as you want to these files. @@ -91,7 +91,7 @@ Workbox takes a lot of the heavy lifting out of precaching by simplifying the AP ### `cachingExtensions` -(String) Loads and inserts the contents of the specified file path into the service worker script, below autogenerated calls to `workbox.precaching.*`. You may add as many extra calls as you want to this file. +(String|String[]) Loads and inserts the contents of the specified file path into the service worker script, below autogenerated calls to `workbox.precaching.*`. You may add as many extra calls as you want to these files. ### `cleanupOutdatedCaches` @@ -129,7 +129,7 @@ Workbox takes a lot of the heavy lifting out of precaching by simplifying the AP ### `routingExtensions` -(String) Loads and inserts the contents of the specified file path into the service worker script, below autogenerated calls to `workbox.routing.*`. You may add as many extra calls as you want to this file. +(String|String[]) Loads and inserts the contents of the specified file path into the service worker script, below autogenerated calls to `workbox.routing.*`. You may add as many extra calls as you want to these files. ### `assetsURLPattern` diff --git a/packages/workbox/lib/utils.js b/packages/workbox/lib/utils.js index 1ff442c7..bc991f54 100644 --- a/packages/workbox/lib/utils.js +++ b/packages/workbox/lib/utils.js @@ -1,7 +1,7 @@ const { readFileSync, existsSync } = require('fs') function readJSFiles (files) { - return Array.from(files) + return Array.from(Array.isArray(files) ? files : [files]) .map(path => { path = this.nuxt.resolver.resolvePath(path) if (path && existsSync(path)) {