Eptagone / Vite.AspNetCore

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

React refresh not injected into HTML when using NuGet package #109

Closed davidjamesb closed 7 months ago

davidjamesb commented 7 months ago

I have cloned the example React project and this works fine when running dotnet run. The vite-dev server starts up and the react-refresh script is injected into the HTML.

I then swapped the existing project reference (src\Vite.AspNetCore\Vite.AspNetCore.csproj) for the latest published NuGet package:

<PackageReference Include="Vite.AspNetCore" Version="1.12.0" />

Re-building and re-running causes the vite-dev server to start, but the react-refresh script is no longer injected into the HTML. Thus, the browser throws the following error and the client site is not loaded:

Uncaught Error: React refresh preamble was not loaded. Something is wrong.

I believe this can be solved by publishing the latest version of the NuGet package.

davidjamesb commented 7 months ago

I just built a NuGet package from the source locally and everything is working fine now, so just seems that the latest NuGet package is out of date.

Eptagone commented 7 months ago

Hi, the NuGet package is outdated. I'm refactoring the code before publishing the package.

Eptagone commented 7 months ago

The new package has been published. So, I'm closing this issue.