From 1c7d48f066e3bd82b7cf075d9b555d7996291792 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 31 Jan 2020 03:36:56 +0800 Subject: [PATCH] fix: correctly calculate cacheIdentifier from lockfiles (#5113) * fix: correctly calculate cacheIdentifier from lockfiles follow up of #3865 fixes #4438 * Revert "fix: correctly calculate cacheIdentifier from lockfiles" This reverts commit dbce88b7cca8b27f5460dee1c5828b2834cbd5ab. * fix: should take all configFiles and lockfiles into account The previous implementation is based on the assumption that config files have precendences, e.g. `.eslintrc.js` will take higher precendence over `.eslintrc`, and only one will take effect. This is not accurate however. For example, babel relies on both babel config and browserslist config, so we need to deal with 2 config files. --- packages/@vue/cli-service/lib/PluginAPI.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/@vue/cli-service/lib/PluginAPI.js b/packages/@vue/cli-service/lib/PluginAPI.js index adc4f700e0..fb20fc6393 100644 --- a/packages/@vue/cli-service/lib/PluginAPI.js +++ b/packages/@vue/cli-service/lib/PluginAPI.js @@ -199,13 +199,10 @@ class PluginAPI { } } - for (const file of configFiles) { + variables.configFiles = configFiles.map(file => { const content = readConfig(file) - if (content) { - variables.configFiles = content.replace(/\r\n?/g, '\n') - break - } - } + return content && content.replace(/\r\n?/g, '\n') + }) const cacheIdentifier = hash(variables) return { cacheDirectory, cacheIdentifier }