Skip to content
This repository was archived by the owner on Dec 26, 2018. It is now read-only.

Commit 3914e57

Browse files
committed
fix optional parts / strict mode
1 parent 15c99ed commit 3914e57

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/compiler.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ compiler.compile = function (content, filePath, cb) {
9090
var script = resolvedParts.script
9191
if (script) {
9292
output +=
93-
script + '\n' +
93+
';(function(){' + script + '})()\n' +
9494
// babel 6 compat
9595
'if (module.exports.__esModule) module.exports = module.exports.default\n'
9696
}
@@ -139,6 +139,7 @@ compiler.compile = function (content, filePath, cb) {
139139
}
140140

141141
function processTemplate (part, filePath, parts) {
142+
if (!part) return Promise.resolve()
142143
var template = getContent(part, filePath)
143144
return compileAsPromise('template', template, part.lang, filePath)
144145
.then(function (res) {
@@ -151,6 +152,7 @@ function processTemplate (part, filePath, parts) {
151152
}
152153

153154
function processScript (part, filePath, parts) {
155+
if (!part) return Promise.resolve()
154156
var lang = part.lang || (hasBabel ? 'babel' : null)
155157
var script = getContent(part, filePath)
156158
return compileAsPromise('script', script, lang, filePath)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy