Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mohammad-hosein-shahpouri/AspNetCore.SpaServices.ViteDevelopmentServer
A library that allows you to use SPAs with Vite.js on ASP.NET Core
https://github.com/mohammad-hosein-shahpouri/AspNetCore.SpaServices.ViteDevelopmentServer
asp-net-core c-charp javascript typescript vite vitejs
Last synced: 7 days ago
JSON representation
A library that allows you to use SPAs with Vite.js on ASP.NET Core
- Host: GitHub
- URL: https://github.com/mohammad-hosein-shahpouri/AspNetCore.SpaServices.ViteDevelopmentServer
- Owner: mohammad-hosein-shahpouri
- License: mit
- Created: 2022-06-20T19:53:26.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-26T11:33:26.000Z (7 months ago)
- Last Synced: 2024-05-29T00:26:50.327Z (6 months ago)
- Topics: asp-net-core, c-charp, javascript, typescript, vite, vitejs
- Language: C#
- Homepage:
- Size: 144 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AspNetCore.SpaServices.ViteDevelopmentServer
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Nuget](https://img.shields.io/nuget/v/AspNetCore.SpaServices.ViteDevelopmentServer)](https://www.nuget.org/packages/AspNetCore.SpaServices.ViteDevelopmentServer/)With this library you will be able to use [Vite.js](https://vitejs.dev) 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.## Install
`$ dotnet add package AspNetCore.SpaServices.ViteDevelopmentServer`
## Usage
```c#
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
```typescript
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## License
Available under MIT License