[bug] ReferenceError: `window` is not defined
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 30/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- nodejs, typescript
- 領域
- networking
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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?
- 主要言語
- TypeScript
- スター
- 59
- フォーク
- 7
- 平均マージ
- 53分
- マージ済み PR(30日)
- 7
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
wevm/isows のほかの issue
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
enhancement severity:low
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
Battle-Cattle/BCUK-Bot-4#1252 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
modelcontextprotocol/inspector#3098 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
onyx-dot-app/onyx#18730 ·
メンテナーはふだん 1 日以内に返信