前后端调试(.net core)

2022-06-17  本文已影响0人  wuzinong

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");

}

});

上一篇下一篇

猜你喜欢

热点阅读