Skip to content

Can't resolve 'fs' Error when reproducing the NextJs example #235

Closed Answered by lochie
Jam516 asked this question in Q&A
Discussion options

You must be logged in to vote

Found an answer on the wagmi repo (thanks @jxom!) Looks like this only occurs if you don't have a the NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID env variable set up as this is an issue with WalletConnect v1 (which connectkit will fall back to if this ID is missing). So setting up this variable (or putting the string directly into the config) might fix this too.

Seems that WalletConnect unneccessarily pulls in Node.js dependencies (previously, Ethers.js polyfilled these, but polyfilling as a side-effect is generally not good practice).

You can mitigate this by polyfilling fs, etc in your Next.js config:

module.exports = {
  webpack: (config) => {
    config.resolve.fallback = { fs: false, net: f…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@Jam516
Comment options

@lochie
Comment options

Answer selected by lochie
@Jam516
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants