1. Parcel
package.json:
"scripts": {
"clean": "rimraf dist && rimraf .parcel-cache && rimraf ../Veracity.Account.Web/wwwroot",
"start": "parcel --dist-dir ../Test.Web/wwwroot -p 5001 --hmr-port 5002",
},
Startup.cs/Program.cs
nuget: Microsoft.AspNetCore.SpaServices.Extensions
if (app.Environment.IsDevelopment())
{
app.UseSpa(spa =>
{
//spa.Options.SourcePath = "wwwroot";
// spa.UseReactDevelopmentServer(npmScript: "start");
spa.UseProxyToSpaDevelopmentServer("http://localhost:3001");
});
}
2. Vite
vite.config.ts:
server: {
// watch: {
// ignored: ['!**/node_modules/**']
// },
hmr: {
clientPort: 44355
}
},
Startup.cs/Program.cs
nuget:Microsoft.AspNetCore.SpaServices.Extensions
app.UseSpa(spa =>
{
//spa.Options.SourcePath = "../veracity.ordermonitor.frontend";
if (env.IsDevelopment())
{
// spa.UseReactDevelopmentServer(npmScript: "start");
spa.UseProxyToSpaDevelopmentServer("http://localhost:3000");
}
});
网友评论