[bug] ReferenceError: `window` is not defined
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 30/100
- Tipo de issue
- Error
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- nodejs, typescript
- Área
- networking
Línea de trabajo
The detection logic is in getNativeWebSocket in src/utils.ts, which checks for a global WebSocket before falling back to the ws package. Reproduce by loading the package from a CommonJS Node script on a runtime without a global WebSocket, then trace where window is referenced. Done when that Node path resolves a WebSocket without a ReferenceError. The issue does not state a proposed fix, so confirm the expected behaviour with maintainers first.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Since I switched to recent versions of viem I am encountering this issue.
Possible related issue
I believe it is related to this https://github.com/wagmi-dev/viem/issues/1329.
Use case from which it comes
- Essentially I am in a setup where my wagmi & viem code is in a common library.
- This library is later imported in two different projects:
- One using Node w/ CommonJS
- One for the browser w/ ES modules
Error details
It seems that when in Node the method getNativeWebSockethere: https://github.com/wagmi-dev/isows/blob/5fd0ad1dd0f955383be002ae5d4a3b930dd4acb5/src/utils.ts#L3
does not detect global.WebSocket (while globalactually exists), meaning that for some reasons WebSocket was not imported before. Do we have to execute some specific commands to trigger the import of the ws npm module?
- Lenguaje dominante
- TypeScript
- Estrellas
- 59
- Forks
- 7
- Merge medio
- 53 min
- PR fusionados (30 d)
- 7
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 wevm/isows
-
disable client side compressionAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 55/100
Todos los issues de wevm/isows
Issues similares
-
[typescript] BasicAuth.fromAuthorizationHeader accepts headers without the Basic scheme prefixAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
enhancement severity:low
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Battle-Cattle/BCUK-Bot-4#1252 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
modelcontextprotocol/inspector#3098 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
onyx-dot-app/onyx#18730 ·
Los mantenedores suelen responder en 1 día