React
The React sample under samples/react
is a Vite + React + TypeScript SPA. npm run build writes a static bundle to
dist/.
AppHost wiring
Section titled “AppHost wiring”builder.AddJavaScriptApp("react", "../react") .WithHttpEndpoint(targetPort: 5173, env: "PORT") .PublishAsNetlifySite( options: new NetlifyDeployOptions { Dir = "dist", NoBuild = true, Site = "<your-site-id>" }, authToken: authToken);builder .addJavaScriptApp("react", "../react") .withHttpEndpoint({ targetPort: 5173, env: "PORT" }) .publishAsNetlifySite( { dir: "dist", noBuild: true, site: "<your-site-id>", }, authToken, );For a single-page app you usually want a Netlify _redirects file containing
/* /index.html 200 so client-side routing works on hard refreshes — drop it
into samples/react/public/.
Build & deploy locally
Section titled “Build & deploy locally”cd samples/reactnpm cinpm run buildcd ../..aspire deploy --apphost samples/AllFrameworks.AppHost/AllFrameworks.AppHost.csproj