nft-catalog icon indicating copy to clipboard operation
nft-catalog copied to clipboard

Nft catalog not working in web enviroment

Open PeterBenc opened this issue 3 years ago • 4 comments

Issue:

  • when importing the npm package into a react app, the app does not load at all
  • the app crashes with Uncaught (in promise) ReferenceError: global is not defined

Possible cause:

  • https://github.com/dapperlabs/nft-catalog/blob/11c950f97512a46d5dc8df5fcd1be3a0da1fca68/webpack.config.js#L4 defined the target as node, https://stackoverflow.com/questions/45175521/referenceerror-global-is-not-defined-at-eval (similar issue on stackoverflow)

Again, thanks for developing this package :+1: helps a lot :)

PeterBenc avatar Oct 06 '22 17:10 PeterBenc

What npm version of the package are you using? Are you able to share the code that you are using to import and use the package?

prpatel05 avatar Oct 06 '22 17:10 prpatel05

The latest from the npm, I dont have my PC here, but I literaly started working with it today. 0.1.1 I think.

I can't really share the my code, but my guess is that it will be the same issue sinple create-react-app since the bundle.js uses global which is not accessible in the browser. At least according to that stack overflow issue.

PeterBenc avatar Oct 06 '22 20:10 PeterBenc

I am also running a react app and having the same "Global is not defined" issue.

ccarnicle avatar Oct 07 '22 07:10 ccarnicle

i think the problem is in the webpack config. nft-catalog is being bundled up for use in a node app: https://github.com/dapperlabs/nft-catalog/blob/main/webpack.config.js#L4

we can add a secondary config that bundles this up for client-side consumption

austinsamsel avatar Dec 12 '22 22:12 austinsamsel