Skip to content

Commit

Permalink
fix(workbox): deepClone options to avoid cross-build mutation
Browse files Browse the repository at this point in the history
fixing issue with nuxt static build that initializes module twice
  • Loading branch information
pi0 committed Dec 20, 2020
1 parent f07d7e8 commit e39027e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"test": "yarn lint && jest"
},
"dependencies": {
"clone-deep": "^4.0.1",
"defu": "^3.2.2",
"execa": "^5.0.0",
"fs-extra": "^9.0.1",
Expand Down
3 changes: 2 additions & 1 deletion src/workbox/options.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { resolve } from 'path'
import cloneDeep from 'clone-deep'
import { joinUrl, getRouteParams, startCase, randomString, PKG_DIR } from '../utils'
import type { WorkboxOptions, PWAContext } from '../../types'
import { defaults } from './defaults'

export function getOptions (nuxt, pwa: PWAContext): WorkboxOptions {
const options: WorkboxOptions = { ...defaults, ...pwa.workbox }
const options: WorkboxOptions = cloneDeep({ ...defaults, ...pwa.workbox })

// enabled
if (options.enabled === undefined) {
Expand Down

0 comments on commit e39027e

Please sign in to comment.