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

[React] Incompatible with Next.js and server side rendering #246

Open
murar8 opened this issue May 8, 2024 · 2 comments
Open

[React] Incompatible with Next.js and server side rendering #246

murar8 opened this issue May 8, 2024 · 2 comments

Comments

@murar8
Copy link

murar8 commented May 8, 2024

Using the library with an SSR framework results in a build error: ReferenceError: self is not defined
I believe the error comes from the connex library which requires a reference to the global window instance on import. Maybe the issue should be moved to the connex package at your discretion.

Steps to reproduce

  • Create a new Next.js project
  • Install @vechain/dapp-kit-react
  • Import any item from the package (you do not need to run any code, just importing is enough to break it)
  • Run either npm run build or npm run dev

Example

https://codesandbox.io/p/devbox/dapp-kit-nextjs-99tmxr

cc @GianBarGian

@darrenvechain
Copy link
Member

Hey @murar8 we have an example for next js (we have to use client side)

https://github.com/vechain/vechain-dapp-kit/blob/main/examples/sample-next-app/src/app/layout.tsx#L8

Once the new SDK is ready, we will replace connex with the new SDK

@GianBarGian
Copy link

@darrenvechain Unfortunately it seems that we are forced to use the whole app with client side rendering in order to be able to make it work.

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

3 participants