I created a Vue app using Vue CLI (vue create foo-app
) to test out the whole process and see how I got on with Vue (using VS Code if it makes any difference).
All good, let's go again but for the actul app I want to use.
The next time I created an app using the Vue JS Template for ASP Net Core Web API from with Visual Studio (2019 edition) (let's call it bar-app
). It built correctly and seemingly no problems.
However when I F5 to run the app from within Visual Studio, instead of getting bar-app
I instead get foo-app
.
The browser launches on port 50800, which is correct and configured within VS. I can see the Vue server running on 8080, and if I point the browser there, I also get the wrong app displayed.
On startup I have:
app.UseSpa(spa =>
{
spa.Options.SourcePath = "ClientApp";
if (env.IsDevelopment())
{
spa.UseVueCli(npmScript: "serve");
}
});
And package.json
has "serve": "vue-cli-service serve"
.
If I manually run the Vue app on its own i.e. open a cmd window at the correct folder and run npm run serve
I can see the server starts but on a different port, 8085, which serves the app I want (bar-app
).
I have tried changing the package.json
command to pass in the port but this fails as when I F5, VS is automatically appending --port 8080
to it (and so the effective command issues is "serve": "vue-cli-service serve --port 8080 -port8085"
So:
- Where have I configured the port to be 8085?
- Why is VS running the app on 8080?