Rari-Capital / rari-dApp

Rari Capital's Web3 Portal.
https://app.rari.capital
GNU Affero General Public License v3.0
151 stars 69 forks source link

ReferenceError: require is not defined #469

Open pmannle opened 2 years ago

pmannle commented 2 years ago

Working on a Rari dashboard, but can't get SDK to load.

I've set node and npm as required: node: v14.17.0 npm: v7.21.0

Script is simply: const Fuse = require("@Rari-Capital/fuse-sdk");

And getting:

ReferenceError: require is not defined
    at file:///Users/phil_mannle/Solidity/fuse-sdk/index.js:1:14
    at ModuleJob.run (internal/modules/esm/module_job.js:152:23)
    at async Loader.import (internal/modules/esm/loader.js:177:24)
    at async Object.loadESM (internal/process/esm_loader.js:68:5)

Can anyone advise?

pmannle commented 2 years ago

Here is my package.json:

{
  "name": "fuse-sdk",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "type": "module",
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@rari-capital/fuse-sdk": "^1.1.0"
  }
}

I've also tried "type":"commonjs"