mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-03-15 22:05:22 -05:00
fix: plugin file serve issue
This commit is contained in:
@@ -516,10 +516,14 @@ function serveFile ({ pluginId, projectId = null, file }, res) {
|
||||
}
|
||||
}
|
||||
|
||||
const basePath = pluginId === '.' ? baseFile : dependencies.getPath({ id: decodeURIComponent(pluginId), file: baseFile })
|
||||
if (basePath) {
|
||||
res.sendFile(path.join(basePath, file), { maxAge: 0 })
|
||||
return
|
||||
if (pluginId) {
|
||||
const basePath = pluginId === '.' ? baseFile : dependencies.getPath({ id: decodeURIComponent(pluginId), file: baseFile })
|
||||
if (basePath) {
|
||||
res.sendFile(path.join(basePath, file))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
console.log('serve issue', 'pluginId:', pluginId, 'projectId:', projectId, 'file:', file)
|
||||
}
|
||||
|
||||
res.status(404)
|
||||
@@ -527,7 +531,7 @@ function serveFile ({ pluginId, projectId = null, file }, res) {
|
||||
}
|
||||
|
||||
function serve (req, res) {
|
||||
const { pluginId, 0: file } = req.params
|
||||
const { id: pluginId, 0: file } = req.params
|
||||
serveFile({ pluginId, file: path.join('ui-public', file) }, res)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user