Vite plugin: 'use-sync-external-store/shim/index.js' is not aliased, dev server crashes with react-aria
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 90/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- react, typescript, vite
- Área
- build-system
Línea de trabajo
Empieza en packages/redact/src/vite/index.ts y revisa las entradas de ALIASES para use-sync-external-store/shim. Añade allí los dos alias de ruta de archivo sugeridos y luego verifica que ambos especificadores se resuelvan a @tanstack/redact en el servidor de desarrollo de Vite. El trabajo estará listo cuando la reproducción ya no falle por la exportación useSyncExternalStore ausente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
react-aria, react-aria-components and react-stately import the use-sync-external-store shim by its file path:
import { useSyncExternalStore } from "use-sync-external-store/shim/index.js";
The Vite plugin alias table does not contain this specifier. It contains use-sync-external-store/shim, but not use-sync-external-store/shim/index.js. The import therefore resolves to the real CJS shim.
In the dev server, the plugin also excludes use-sync-external-store* from optimizeDeps. The browser then loads the raw CJS file as ESM, and the root render crashes:
SyntaxError: The requested module '/node_modules/use-sync-external-store/shim/index.js?v=…'
does not provide an export named 'useSyncExternalStore'
The production build does not crash, because Rolldown converts the CJS file.
Reproduction
- Create a Vite + React SPA with
redact()inplugins. - Render any component from
react-aria-componentsthat usesuseSyncExternalStore. Examples:Sheet, a toast region (useToastState), or a collection component (CollectionBuilder). - Run
vite(the dev server) and open the page.
Result: blank page and the error above. Expected: the shim resolves to @tanstack/redact, the same as use-sync-external-store/shim.
Workaround
Add the specifier as an alias in the app's vite.config.ts:
resolve: {
alias: {
"use-sync-external-store/shim/index.js": "@tanstack/redact",
},
},
With this alias, our full e2e suite (66 Playwright tests) passes on Redact.
Suggested fix
Add these entries to ALIASES in packages/redact/src/vite/index.ts, before use-sync-external-store/shim:
'use-sync-external-store/shim/index.js': '@tanstack/redact',
'use-sync-external-store/index.js': '@tanstack/redact',
Versions
@tanstack/redact0.2.0. The alias table onmain(d56d87cb) has the same gap.vite8.3.4react-aria3.53.1,react-aria-components1.22.1,react-stately3.51.0
- Lenguaje dominante
- TypeScript
- Estrellas
- 408
- Forks
- 13
- Merge medio
- 1 h 44 min
- PR fusionados (30 d)
- 21
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TanStack/redact
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Bug: jsx runtime doesn't apply defaultProps (breaks Recharts 2: "Could not find xAxis by id")Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
TanStack/redact#58 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/redact
Issues similares
-
fix(worker): keep normal prepare waiting states failure-freePosiblemente ocupada @LichKing-2234 la tomó hoy. Abiertoagent:codex priority:P1
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
AgoraIO-Extensions/agent-infra#3745 ·
Los mantenedores suelen responder en 1 día
-
The five-line work window can drop its oldest line: the per-line byte share ignores the JSON framingPosiblemente ocupada @Eapp1e la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
makecindy/cindy#7973 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
lingdojo/kana-dojo#33337 · 1 comentario · 5 reacciones ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
coder/xum#7733 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
code-yeongyu/senpi#4917 · 1 comentario ·
Los mantenedores suelen responder en 1 día