Eptagone / Vite.AspNetCore

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

Combine relative PackageDirectory path with the ContentRootPath #45

Closed jdryden572 closed 1 year ago

jdryden572 commented 1 year ago

When specifying the PackageDirectory property in ViteOptions, treat non-rooted directory paths as though they are relative to the IWebHostEnvironment.ContentRootPath. This path will be the Project directory when running during development.

Fixes #44

I tested this with a project structure like below, where the Vite client application (both package.json and vite.config.js) are within a child folder of the package directory:

AspNetProject/
├─ ClientApp/
│  ├─ package.json
│  ├─ vite.config.js/
│  ├─ main.js
├─ AspNetProject.csproj/
├─ Program.cs/

I also tested with a folder structure that has the Vite client application outside the project directory entirely (similar to Webcoda's project in the bug report).

ClientApp/
├─ package.json
├─ vite.config.js/
├─ main.js
AspNetProject/
├─ AspNetProject.csproj/
├─ Program.cs/