fix(nitro): detect routes and middleware starting with dots (#2771)

This commit is contained in:
Daniel Roe 2022-01-18 16:37:40 +00:00 committed by GitHub
parent 23b230b34b
commit 8588f749ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,8 +47,8 @@ export function scanMiddleware (serverDir: string, onChange?: (results: ServerMi
const apiDir = resolve(serverDir, 'api')
const scan = async () => {
const globalFiles = await globby(pattern, { cwd: globalDir })
const apiFiles = await globby(pattern, { cwd: apiDir })
const globalFiles = await globby(pattern, { cwd: globalDir, dot: true })
const apiFiles = await globby(pattern, { cwd: apiDir, dot: true })
return [
...filesToMiddleware(globalFiles, globalDir, '/', { route: '/' }),
...filesToMiddleware(apiFiles, apiDir, '/api', { lazy: true })