nft-catalog
nft-catalog copied to clipboard
Nft catalog not working in web enviroment
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 :)
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?
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.
I am also running a react app and having the same "Global is not defined" issue.
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