Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npx serve . does not always serve the current directory #808

Open
obrassard opened this issue Jul 19, 2024 · 0 comments
Open

npx serve . does not always serve the current directory #808

obrassard opened this issue Jul 19, 2024 · 0 comments

Comments

@obrassard
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant