diff --git a/lib/template-compiler-plugin.js b/lib/template-compiler-plugin.js index 4beb2d80..e341b8e3 100644 --- a/lib/template-compiler-plugin.js +++ b/lib/template-compiler-plugin.js @@ -118,7 +118,7 @@ class TemplateCompiler extends Filter { this._optionsHash = crypto .createHash('md5') .update(stringify(this._buildOptionsForHash()), 'utf8') - .update(stringify(this._templateCompilerContents()), 'utf8') + .update(utils.getTemplateCompilerCacheKey(this.options.templateCompilerPath), 'utf8') .digest('hex'); } diff --git a/lib/utils.js b/lib/utils.js index dd051799..de3d4264 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -262,10 +262,15 @@ function setup(pluginInfo, options) { return plugin; } -function makeCacheKey(templateCompilerPath, pluginInfo, extra) { +function getTemplateCompilerCacheKey(templateCompilerPath) { let templateCompilerFullPath = require.resolve(templateCompilerPath); let { templateCompilerCacheKey } = TemplateCompilerCache.get(templateCompilerFullPath); + return templateCompilerCacheKey; +} + +function makeCacheKey(templateCompilerPath, pluginInfo, extra) { + let templateCompilerCacheKey = getTemplateCompilerCacheKey(templateCompilerPath); let cacheItems = [templateCompilerCacheKey, extra].concat(pluginInfo.cacheKeys.sort()); // extra may be undefined @@ -347,4 +352,5 @@ module.exports = { isInlinePrecompileBabelPluginRegistered, buildParalleizedBabelPlugin, getTemplateCompiler, + getTemplateCompilerCacheKey, };