With this library you will be able to use Vite.js with your SPA in ASP.NET Core.
Vite.js is an opinionated build tool that enables lightning-fast development by relying on non-bundled JavaScript modules.
$ dotnet add package AspNetCore.SpaServices.ViteDevelopmentServer
app.UseSpa(spa =>
{
spa.Options.SourcePath = "ClientApp";
if (app.Environment.IsDevelopment()) spa.UseViteDevelopmentServer(npmScript: "dev", useHttps: true);
});
and if you want to use HMR WebSocket (Hot Reload) you should add
server: {
port: Number(process.env.PORT),
hmr: {
protocol: 'wss',
host: 'localhost',
port: Number(process.env.HMR_PORT)
}
}
to your vite.config.js or vite.config.ts file
Available under MIT License