- 
                Notifications
    You must be signed in to change notification settings 
- Fork 132
Closed
Milestone
Description
Describe the bug
when you use AddViteApp, it does "WithHttpEndpoint" under the hood but doesn't wire it up to anything, meaning you have to have a separate named endpoint with the targetport as 5173 (Vite's default). We should read that from the Vite runtime config and set it as part of AddViteApp.
Related #696
Regression
No response
Steps to reproduce
var frontend = builder.AddViteApp("frontend", "../frontend", packageManager: "pnpm")
    .WithPnpmPackageInstallation()
    .WithReference(ratingsApi);
That won't work without manually navigating to localhost:5173
var frontend = builder.AddViteApp("frontend", "../frontend", packageManager: "pnpm")
    .WithPnpmPackageInstallation()
    .WithReference(ratingsApi)
    .WithHttpEndpoint(targetPort: 5173);
That won't work because "http" endpoint is allocated in AddViteApp
var frontend = builder.AddViteApp("frontend", "../frontend", packageManager: "pnpm")
    .WithPnpmPackageInstallation()
    .WithReference(ratingsApi)
    .WithHttpEndpoint(name: "frontend", targetPort: 5173);
This works but as the secondary url which is annoying
Expected behavior
Aspire should assign a port that auto proxies to 5173 (or whatever Vite sets at runtime)
Screenshots
No response
IDE and version
Other
IDE version
VS Code
Nuget packages
CommunityToolkit.Aspire.Hosting.NodeJSExtensions
Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item
Copilot