Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Vite plugin: 'use-sync-external-store/shim/index.js' is not aliased, dev server crashes with react-aria

Abierto Apto para principiantes
#67 0 comentarios 1 reacción 0 asignados Ver en GitHub

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
  1. Create a Vite + React SPA with redact() in plugins.
  2. Render any component from react-aria-components that uses useSyncExternalStore. Examples: Sheet, a toast region (useToastState), or a collection component (CollectionBuilder).
  3. 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/redact 0.2.0. The alias table on main (d56d87cb) has the same gap.
  • vite 8.3.4
  • react-aria 3.53.1, react-aria-components 1.22.1, react-stately 3.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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de TanStack/redact

Todos los issues de TanStack/redact

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.