Eptagone / Vite.AspNetCore

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

Setting a "Base" path argument breaks dev server requests #101

Open firegodjr opened 6 months ago

firegodjr commented 6 months ago

Describe the bug Setting "Base" option affects dev server file paths, not only resulting webroot files as described in the readme

To Reproduce

  1. Set "Base" to anything in appsettings.Development.json
  2. Try to run with dev server and middleware
  3. See that browser requests for files are now broken because they're now based on the base path, this also breaks the request for @vite/client

Expected behavior Base path only affects files in the webroot after build

Screenshots image image

Device (please complete the following information):

Additional context N/A

firegodjr commented 6 months ago

If the base path behavior is intentional, it would be nice to have a separate "DevBase" and "WebrootBase", rather than using a single value for both.

Eptagone commented 5 months ago

Hi, do you want to compile your assets to wwwroot/views, right?

micpog commented 4 months ago

I see the same behavior on my end. Base value is taken from appsettings.json and affects dev server. Luckily this can be overcomed by specifing outDir for build in vite.config.js and then in csproj specify correct <DistFiles Include="<path-to-build-output>" />