Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": {
"@nuxt/devalue": "^1.2.5",
"clone-deep": "^4.0.1",
"defu": "^3.2.2",
"execa": "^5.0.0",
Expand Down
6 changes: 5 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { posix, resolve, dirname } from 'path'
import { mkdirp, readFile, existsSync, writeFile } from 'fs-extra'
import template from 'lodash.template'
import devalue from '@nuxt/devalue'
import { name, version } from '../package.json'

export const PKG = {
Expand Down Expand Up @@ -102,7 +103,10 @@ export function pick (obj, props) {
}

export async function copyTemplate ({ src, dst, options }) {
const compile = template(await readFile(src, 'utf8'))
const compile = template(
await readFile(src, 'utf8'),
{ imports: { devalue } }
)
await writeFile(dst, compile({ options }))
}

Expand Down
2 changes: 1 addition & 1 deletion templates/workbox/sw.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const options = <%= JSON.stringify(options.swOptions) %>
const options = <%= devalue(options.swOptions) %>

importScripts(...[options.workboxURL, ...options.importScripts])

Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,13 @@
dependencies:
consola "^2.9.0"

"@nuxt/devalue@^1.2.5":
version "1.2.5"
resolved "https://registry.yarnpkg.com/@nuxt/devalue/-/devalue-1.2.5.tgz#8d95e3e74b3332d3eb713342c5c4d18096047d66"
integrity sha512-Tg86C7tqzvZtZli2BQVqgzZN136mZDTgauvJXagglKkP2xt5Kw3NUIiJyjX0Ww/IZy2xVmD0LN+CEPpij4dB2g==
dependencies:
consola "^2.9.0"

"@nuxt/friendly-errors-webpack-plugin@^2.5.0":
version "2.5.0"
resolved "https://registry.yarnpkg.com/@nuxt/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-2.5.0.tgz#5374665bc72d34b7dbadcc361a4777e3f0f5d46b"
Expand Down