Eptagone / Vite.AspNetCore

Small library to integrate Vite into ASP.NET projects
MIT License
264 stars 35 forks source link

v1.8.0 now always redirects to Vite server instead of loading the dotnet application #37

Closed Webcoda closed 1 year ago

Webcoda commented 1 year ago

When I use version 1.8.0, I can't load the dotnet application anymore (I'm using Umbraco)

Using v1.6.2 and below can load the dotnet application and run vite dev server at the same time. Not sure what happened on v1.8.0.

I skipped v1.7 because it doesn't allow me to set WorkingDirectory (on v1.6.2 and below) or PackageDirectory on v1.8.

Could you please help?

Logs on v1.6.2 image

Logs on v1.8 image

Eptagone commented 1 year ago

Hello, do you have a minimal repro project? to track the problem faster.

Webcoda commented 1 year ago

Hi @Eptagone thanks for responding

Here is a minimal repro project: https://github.com/Webcoda/test-viteaspnetcore18

you might need to

  1. Run pnpm install on FE_DEV folder
  2. To repro, you can run dotnet build && dotnet run on UmbracoCMS\
  3. To run the Umbraco correctly, you can comment line 70 in UmbracoCMS\Startup.cs
Eptagone commented 1 year ago

Hi @Webcoda, thanks. I'll take a look.

Webcoda commented 1 year ago

@Eptagone I think I might have found the way to fix it.

I put the app.UseViteDevMiddleware() after app.UseUmbraco() and it works ok now

image

Eptagone commented 1 year ago

Hi, I see. So, it's just an issue with the order of the middlewares. Something similar happened with another issue (#12)

Webcoda commented 1 year ago

Yes, I believe so. I need to put the app.UseViteDevMiddleWare() after app.UseUmbraco() if I use v1.8.0 and before app.UseUmbraco() for version v1.6.2