Skip to content

Commit 51afe59

Browse files
author
Guillaume Chau
committed
fix: plugin file serve issue
1 parent 7ebaa8a commit 51afe59

File tree

1 file changed

+9
-5
lines changed
  • packages/@vue/cli-ui/apollo-server/connectors

1 file changed

+9
-5
lines changed

packages/@vue/cli-ui/apollo-server/connectors/plugins.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,18 +516,22 @@ function serveFile ({ pluginId, projectId = null, file }, res) {
516516
}
517517
}
518518

519-
const basePath = pluginId === '.' ? baseFile : dependencies.getPath({ id: decodeURIComponent(pluginId), file: baseFile })
520-
if (basePath) {
521-
res.sendFile(path.join(basePath, file), { maxAge: 0 })
522-
return
519+
if (pluginId) {
520+
const basePath = pluginId === '.' ? baseFile : dependencies.getPath({ id: decodeURIComponent(pluginId), file: baseFile })
521+
if (basePath) {
522+
res.sendFile(path.join(basePath, file))
523+
return
524+
}
525+
} else {
526+
console.log('serve issue', 'pluginId:', pluginId, 'projectId:', projectId, 'file:', file)
523527
}
524528

525529
res.status(404)
526530
res.send(`Addon ${pluginId} not found in loaded addons. Try opening a vue-cli project first?`)
527531
}
528532

529533
function serve (req, res) {
530-
const { pluginId, 0: file } = req.params
534+
const { id: pluginId, 0: file } = req.params
531535
serveFile({ pluginId, file: path.join('ui-public', file) }, res)
532536
}
533537

0 commit comments

Comments
 (0)