From c2ea0c5acef547600ec18af0e531c265a6166653 Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Wed, 11 May 2016 01:04:38 -0700 Subject: [PATCH] Only pass moduleName if available and is not `unknown` --- index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index ac416a38..4067aecc 100644 --- a/index.js +++ b/index.js @@ -4,10 +4,13 @@ module.exports = function(precompile) { var replaceNodeWithPrecompiledTemplate = function(node, template, file) { var moduleName = file.opts && file.opts.filenameRelative; + var opts = {}; - var compiledTemplateString = "Ember.HTMLBars.template(" + precompile(template, { - moduleName: moduleName - }) + ")"; + if (moduleName && moduleName !== 'unknown') { + opts.moduleName = moduleName; + } + + var compiledTemplateString = "Ember.HTMLBars.template(" + precompile(template, opts) + ")"; // Prefer calling replaceWithSourceString if it is present. // this prevents a deprecation warning in Babel 5.6.7+.