ensdomains / ensjs

ENS javascript library for contract interaction
MIT License
121 stars 56 forks source link

Can't use in nodejs context: "ReferenceError: localStorage is not defined" #23

Closed holic closed 2 years ago

holic commented 2 years ago

I tried to use this package via a Next.js API route and I am getting the following error:

ReferenceError: localStorage is not defined
holic commented 2 years ago

I think these kinds of conditionals: https://github.com/ensdomains/ensjs-v3/blob/5d9f60b92f9f789762c638c485b014d3ce15206c/packages/ensjs/src/utils/labels.ts#L40-L42 should look like:

typeof localStorage !== 'undefined' ? ...