`AddViteApp` with `WithHttpsDeveloperCertificate` will silently skip HTTPS setup if Vite config is missing
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
`WithHttpsDeveloperCertificate` will silently skip HTTPS setup when Vite app doesn't have a config file.
Current workaround is to add at least minimal `vite.config.ts` with default export.
```ts
export default { }
```
### Expected Behavior
1. Aspire still automatically configures HTTPS even when Vite config is missing by generating required config.
2. Or produces a warning indicating that HTTPS won't be configured.
Currently Aspire will produce a warning only when wrapping an existing vite config throws an exception: https://github.com/dotnet/aspire/blob/af7a881f1c5e301151786890d6cb74d8c7b59823/src/Aspire.Hosting.JavaScript/JavaScriptHostingExtensions.cs#L616
### Steps To Reproduce
1. Clone https://github.com/romansp/aspire-ts-cs
2. Run `aspire run`
3. Inspect console logs of `webfrontend` Vite app.
Vite server still runs on http. No warning due to missing vite config.
```
Waiting for resource 'webfrontend-installer' to complete.
Waiting for resource 'server' to enter the 'Running' state.
Waiting for resource 'server' to become healthy.
Finished waiting for resource 'webfrontend-installer'.
Waiting for resource ready to execute for 'server'.
Finished waiting for resource 'server'.
> frontend@0.0.0 dev
> vite --port 58411
VITE v7.2.6 ready in 128 ms
➜ Local: http://localhost:58411/
➜ Network: use --host to expose
[sys] Starting process...: Cmd = /Users/roman/.nvm/versions/node/v22.17.1/bin/npm, Args = ["run", "dev", "--", "--port", "58411"]
```
### Exceptions (if any)
_No response_
### .NET Version info
```
.NET SDK:
Version: 10.0.100
Commit: b0f34d51fc
Workload version: 10.0.100.1
MSBuild version: 18.0.2+b0f34d51f
Runtime Environment:
OS Name: Mac OS X
OS Version: 15.7
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/10.0.100/
.NET workloads installed:
[wasm-tools]
Installation Source: SDK 10.0.100
Manifest Version: 10.0.100/10.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/10.0.100/microsoft.net.workload.mono.toolchain.current/10.0.100/WorkloadManifest.json
Install Type: FileBased
Configured to use workload sets when installing new manifests.
Host:
Version: 10.0.0
Architecture: arm64
Commit: b0f34d51fc
.NET SDKs installed:
8.0.403 [/usr/local/share/dotnet/sdk]
8.0.404 [/usr/local/share/dotnet/sdk]
10.0.100-rc.1.25451.107 [/usr/local/share/dotnet/sdk]
10.0.100-rc.2.25502.107 [/usr/local/share/dotnet/sdk]
10.0.100 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.33 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.14 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0-rc.1.25451.107 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0-rc.2.25502.107 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.33 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.14 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0-rc.1.25451.107 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0-rc.2.25502.107 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
x64 [/usr/local/share/dotnet/x64]
registered at [/etc/dotnet/install_location_x64]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
```
### Anything else?
- Aspire.AppHost.Sdk 13.1.0
- Aspire.Hosting.JavaScript 13.1.0
Contributor guide
Assessment
This issue has not been assessed yet.