Skip to content

Commit dbce88b

Browse files
committed
fix: correctly calculate cacheIdentifier from lockfiles
follow up of vuejs#3865 fixes vuejs#4438
1 parent 592b305 commit dbce88b

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

packages/@vue/cli-service/lib/PluginAPI.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,6 @@ class PluginAPI {
175175
if (!Array.isArray(configFiles)) {
176176
configFiles = [configFiles]
177177
}
178-
configFiles = configFiles.concat([
179-
'package-lock.json',
180-
'yarn.lock',
181-
'pnpm-lock.yaml'
182-
])
183178

184179
const readConfig = file => {
185180
const absolutePath = this.resolve(file)
@@ -207,6 +202,18 @@ class PluginAPI {
207202
}
208203
}
209204

205+
const lockfiles = [
206+
'package-lock.json',
207+
'yarn.lock',
208+
'pnpm-lock.yaml',
209+
// technically not a lockfile, but should also be taken into account
210+
'package.json'
211+
]
212+
variables.dependencies = lockfiles.map(f => {
213+
const content = readConfig(f)
214+
return content && content.replace(/\r\n?/g, '\n')
215+
})
216+
210217
const cacheIdentifier = hash(variables)
211218
return { cacheDirectory, cacheIdentifier }
212219
}

0 commit comments

Comments
 (0)