[cli][dev] fix: creating "api/some-func.js" after "vc dev" now works (#8041)

If there is no `api` directory, then you run `vc dev`, then you create a new function `api/some-func.js`, then this file would not be served as a new function.

This was being caused by incomplete "new file" handling logic. This PR ensures that the proper detection is done in each new file (`getVercelConfig`) that populates key properties (`apiDir`, `apiExtensions`, and extensionless `files`) for determining when a file is used to serve a request.
This commit is contained in:
Sean Massa
2022-06-29 13:37:48 -05:00
committed by GitHub
parent 9a3739bebd
commit bba7cbd411
3 changed files with 58 additions and 2 deletions

View File

@@ -329,6 +329,8 @@ export default class DevServer {
): Promise<void> {
const name = relative(this.cwd, fsPath);
try {
await this.getVercelConfig();
this.files[name] = await FileFsRef.fromFsPath({ fsPath });
const extensionless = this.getExtensionlessFile(name);
if (extensionless) {