diff --git a/index.js b/index.js index b91d8ed6..9d6555de 100644 --- a/index.js +++ b/index.js @@ -78,12 +78,19 @@ module.exports = { parallelConfig } }; - // parallelBabelInfo will not be used in the cache unless it is explicitly included - let cacheKey = AstPlugins.makeCacheKey(templateCompilerPath, pluginInfo, JSON.stringify(parallelBabelInfo)); + + let cacheKey; babelPlugins.push({ _parallelBabel: parallelBabelInfo, baseDir: () => __dirname, - cacheKey: () => cacheKey, + cacheKey: () => { + if (cacheKey === undefined) { + // parallelBabelInfo will not be used in the cache unless it is explicitly included + cacheKey = AstPlugins.makeCacheKey(templateCompilerPath, pluginInfo, JSON.stringify(parallelBabelInfo)); + } + + return cacheKey; + }, }); } else { diff --git a/lib/ast-plugins.js b/lib/ast-plugins.js index 72fd9ba5..de72593c 100644 --- a/lib/ast-plugins.js +++ b/lib/ast-plugins.js @@ -53,7 +53,7 @@ module.exports = { global.EmberENV = clonedEmberENV; let Compiler = require(templateCompilerPath); - let cacheKey = this.makeCacheKey(templateCompilerPath, pluginInfo); + let cacheKey; let precompileInlineHTMLBarsPlugin; @@ -61,7 +61,13 @@ module.exports = { let precompile = Compiler.precompile; precompile.baseDir = () => path.resolve(__dirname, '..'); - precompile.cacheKey = () => cacheKey; + precompile.cacheKey = () => { + if (cacheKey === undefined) { + cacheKey = this.makeCacheKey(templateCompilerPath, pluginInfo); + } + + return cacheKey; + }; let modulePaths = ['ember-cli-htmlbars-inline-precompile', 'htmlbars-inline-precompile']; precompileInlineHTMLBarsPlugin = [HTMLBarsInlinePrecompilePlugin, { precompile, modulePaths }];