Eptagone / Vite.AspNetCore

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

Add --host support for autorun #135

Open rakkur opened 1 month ago

rakkur commented 1 month ago

I'm unable to specify the --host parameter when using the autorun feature for Vite. I need --host to be running so that I can test my solution locally from Cypress (it is reporting that the url at localhost is empty, whereas I can open the manifest/main.ts files from any other browser).

Ideal solution would be to add a section in appsettings.json to configure this setting. I did not see anything in the docs that would allow me to enable it.

image

Eptagone commented 1 month ago

Hi, there is already an option for that called Server:Host in the available options. Didn't it work for you?

rakkur commented 1 month ago

Hi @Eptagone - I see! However, the document states:

The host where the Vite Dev Server will be running. Default value is localhost.

This led me to think that this property alters the domain name that vite will be run from. eg: https://newdomain:5174.

However, when I specify some text here I see it does run with the --host flag and the domain in vite remains specified as localhost. What is the purpose of the actual text specified in this argument, then? I do see that the backend is using this url.. somehow?

image

My issue is ultimately now resolved, I'm more just curious if we can help improve the documents so everyone else understands what's going on here with this parameter. Thanks for your help!