Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] ReferenceError: window is not defined #8

Open
ennioVisco opened this issue Nov 8, 2023 · 0 comments
Open

[bug] ReferenceError: window is not defined #8

ennioVisco opened this issue Nov 8, 2023 · 0 comments

Comments

@ennioVisco
Copy link

ennioVisco commented Nov 8, 2023

Since I switched to recent versions of viem I am encountering this issue.

Possible related issue

I believe it is related to this wevm/viem#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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant