Skip to content

Commit d0f96de

Browse files
committedSep 9, 2019
fix: revert compileTemplate as is fixed by nuxt/nuxt#6283 for 2.9.x
1 parent 4916ce6 commit d0f96de

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed
 

‎lib/workbox/module.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const path = require('path')
22

33
const { getOptions } = require('./options')
4-
const { readJSFiles, compileTemplate } = require('./utils')
4+
const { readJSFiles } = require('./utils')
55

66
module.exports = function nuxtWorkbox (workboxOptions) {
77
this.nuxt.hook('build:before', async () => {
@@ -27,7 +27,7 @@ module.exports = function nuxtWorkbox (workboxOptions) {
2727

2828
// Add sw.js
2929
if (options.swTemplate) {
30-
await compileTemplate.call(this, {
30+
await this.addTemplate({
3131
src: options.swTemplate,
3232
fileName: options.swDest,
3333
options: {

‎lib/workbox/utils.js

+1-16
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,6 @@ async function readJSFiles (files) {
1616
return contents.join('\n\n')
1717
}
1818

19-
async function compileTemplate ({ src, fileName, options }) {
20-
const fileContent = await readFile(src, 'utf8')
21-
try {
22-
const templateFunction = template(fileContent)
23-
const contents = templateFunction({
24-
dev: this.options.dev,
25-
options
26-
})
27-
await outputFile(fileName, contents, 'utf8')
28-
} catch (err) {
29-
throw new Error(`Could not compile template ${src}: ${err.message}`)
30-
}
31-
}
32-
3319
module.exports = {
34-
readJSFiles,
35-
compileTemplate
20+
readJSFiles
3621
}

0 commit comments

Comments
 (0)
Please sign in to comment.