From bb09fcc82049aae5e0ac96314fb07d62979794b6 Mon Sep 17 00:00:00 2001 From: Kael Date: Tue, 29 Jan 2019 18:13:40 +1100 Subject: [PATCH] fix: ignore pug compiler errors fixes #39 --- lib/loader.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/loader.js b/lib/loader.js index fdd6d12..0a7128d 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -89,11 +89,13 @@ module.exports = async function (content, sourceMap) { } if (component.template.lang === 'pug') { const pug = requirePeer('pug') - component.template.content = pug.compile(component.template.content)() + try { + component.template.content = pug.render(component.template.content) + } catch (err) {/* Ignore compilation errors, they'll be picked up by other loaders */} } compiler.compile(component.template.content, { modules: [{ - postTransformNode: node => { + postTransformNode: node => { Object.keys(node.attrsMap).forEach(attr => attrs.add(attr)) tags.add(node.tag) }