Azure / Azure/static-web-apps-cli

SWA start is broken when using Vite and TypeScript

Abierto
#956 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
668
Forks
156
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Before filing this issue, please ensure you're using the latest CLI by running `swa --version` and comparing to the latest version on [npm](https://www.npmjs.com/package/@azure/static-web-apps-cli).

swa version: 2.0.6

**Are you accessing the CLI from the default port `:4280` ?**

- [ ] No, I am using a different port number (`--port`) and accessing the CLI from that port
- [x] Yes, I am accessing the CLI from port `:4280`

> Make sure you are accessing the URL printed in the console when running `swa start`!

**ℹ️ NOTE: Make sure to enable debug logs when running any `swa` commands using `--verbose=silly`**

**Describe the bug**
When using latest Vite (>=6.3.5) dev server and a TypeScript project, SWA CLI fails to load through the dev proxy (:4280) while it work using the Vite dev server directly (:5173).

![Image](https://github.com/user-attachments/assets/e1e8629a-90a5-4652-9bbf-4e1350c7e43a)

The issue seems to that the MIME type is changed when going through the SWA proxy, changing from `text/javascript` to `video/m2pt`.

**To Reproduce**
Steps to reproduce the behavior:

1. Create a new project folder, and run `npm create vite@latest repro -- --template lit-ts`
2. `cd repro && npm install && npm install -D @azure/static-web-apps-cli`
3. Add this `swa-cli.config.json`:
```json
{
"$schema": "https://aka.ms/azure/static-web-apps-cli/schema",
"configurations": {
"registration-website": {
"appLocation": ".",
"run": "npm run dev",
"appDevServerUrl": "http://localhost:5173"
}
}
}

```
4. Run `npx swa start`

**Expected behavior**
Requests going through the proxy do not alter the MIME type

**Desktop (please complete the following information):**

- OS: MacOS
- Version 15.4.1 (24E263)

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Reproduce el problema con el proyecto Vite lit-ts documentado, swa-cli.config.json y `npx swa start`, y compara el servidor Vite directo en :5173 con el proxy SWA en :4280 usando registros detallados. Rastrea la ruta del proxy de `swa start` y verifica que las respuestas JavaScript conserven el tipo MIME `text/javascript` en lugar de convertirse en `video/m2pt`.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript, vite
Área
cli, networking
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.