`npx serve .` does not always serve the current directory
Description
We have a Vue JS application with the following file hierarchy :
- vue/
- .turbo/
- dist/
- index.html
- assets/
- ...
- src/
- ...
- index.html
- package.json
- ...
When trying to serve files from the dist/ directory using the command npx serve dist everything work as intended. However, if I cd into the dist directory from the vue directory and run npx serve . or simply npx serve, the file that is served is vue/index.html instead of vue/dist/index.html (as if the root of the server was vue/ instead of vue/dist/).
I found out that if I delete the vue/package.json file and restart npx serve in vue/dist, the right files are served.
Is this an expected behaviour to use the nearest package.json location as server root ? For me, it seems strange that the root is not the directory from which npx serve . is being executed.
Library version
14.2.3
Node version
18.18.2
Source: vercel/serve