Skip to content

Doc best practices/expected usage for default vite app port #696

@maddymontaquila

Description

@maddymontaquila

Page URL

https://learn.microsoft.com/en-us/dotnet/aspire/community-toolkit/hosting-nodejs-extensions?tabs=dotnet-cli%2Cyarn#run-vite-apps

Describe the issue

Vite defaults their dev server to port 5173 (and then increments it if its taken) - when you follow the docs there is no guidance about setting targetPort or anything. The default endpoint handled by Aspire spins forever then fails because it doesn't point to 5173 (which works fine) -

Image
var frontend = builder.AddViteApp("frontend", "../frontend", packageManager: "pnpm")
    .WithPnpmPackageInstallation()
    .WithReference(ratingsApi)
    .WithExternalHttpEndpoints();

Suggestion

We should either handle that in the Vite extension by default or add
.WithHttpEndpoint(targetPort: 5173)
to the docs.

Additional context

No response

Help us help you

No, just wanted to report this

Metadata

Metadata

Assignees

No one assigned

    Labels

    Staleawaiting responseWaiting for the author of the issue to provide more information or answer a question

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions