Skip to content

Commit

Permalink
fix: correctly calculate cacheIdentifier from lockfiles (#5113)
Browse files Browse the repository at this point in the history
* fix: correctly calculate cacheIdentifier from lockfiles

follow up of #3865
fixes #4438

* Revert "fix: correctly calculate cacheIdentifier from lockfiles"

This reverts commit dbce88b.

* 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.
  • Loading branch information
sodatea committed Jan 30, 2020
1 parent b12574d commit d11ecc2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/@vue/cli-service/lib/PluginAPI.js
Expand Up @@ -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 }
Expand Down

0 comments on commit d11ecc2

Please sign in to comment.