From 3474486a9d03b79cb952b3ae702a5e6a7662f914 Mon Sep 17 00:00:00 2001 From: Andrew Mao Date: Sat, 9 Dec 2017 23:48:18 -0500 Subject: [PATCH] Add file name/path to caching compiler. Fixes #258 --- packages/vue-component/plugin/vue-compiler.js | 6 +++++- packages/vue-router/plugin/plugin.js | 5 ++++- packages/vue-router2/plugin/plugin.js | 5 ++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/vue-component/plugin/vue-compiler.js b/packages/vue-component/plugin/vue-compiler.js index a2f1028..593dc8b 100644 --- a/packages/vue-component/plugin/vue-compiler.js +++ b/packages/vue-component/plugin/vue-compiler.js @@ -126,7 +126,11 @@ VueComponentCompiler = class VueCompo extends CachingCompiler { getCacheKey(inputFile) { let cache = Cache.getCache(inputFile) - return inputFile.getSourceHash() + '_' + cache.dependencyManager.lastChangeTime + return [ + inputFile.getSourceHash(), + inputFile.getPathInPackage(), + cache.dependencyManager.lastChangeTime + ] } compileResultSize(compileResult) { diff --git a/packages/vue-router/plugin/plugin.js b/packages/vue-router/plugin/plugin.js index 21e7339..b98aa72 100644 --- a/packages/vue-router/plugin/plugin.js +++ b/packages/vue-router/plugin/plugin.js @@ -14,7 +14,10 @@ class VueRouterCompiler extends CachingCompiler { } getCacheKey(inputFile) { - return inputFile.getSourceHash(); + return [ + inputFile.getSourceHash(), + inputFile.getPathInPackage() + ]; } compileResultSize(compileResult) { diff --git a/packages/vue-router2/plugin/plugin.js b/packages/vue-router2/plugin/plugin.js index 7fac6cc..c09d62c 100644 --- a/packages/vue-router2/plugin/plugin.js +++ b/packages/vue-router2/plugin/plugin.js @@ -13,7 +13,10 @@ class VueRouterCompiler extends CachingCompiler { } getCacheKey (inputFile) { - return inputFile.getSourceHash() + return [ + inputFile.getSourceHash(), + inputFile.getPathInPackage() + ] } compileResultSize (compileResult) {