tsdev
tsdev

Reputation: 21

Importing jsforce in typescript react application results in error

I'm using react function based components with typescript - webpack version 5.74 importing jsforce is resulting in the following error:

Uncaught TypeError: Super expression must either be null or a function
    at _inherits (index.js:43:107)
    at index.js:92:1
    at ./node_modules/csv-parse/lib/es5/index.js (index.js:1386:2)
    at __webpack_require__ (bootstrap:24:1)
    at fn (hot module replacement:62:1)
    at ./node_modules/jsforce/lib/csv.js (csv.js:4:16)
    at __webpack_require__ (bootstrap:24:1)
    at fn (hot module replacement:62:1)
    at ./node_modules/jsforce/lib/record-stream.js (record-stream.js:15:14)
    at __webpack_require__ (bootstrap:24:1)

Typescript Class:

import jsforce from "jsforce";

const generateAuthUrl = () => {
  const oAuth2 = jsforce.OAuth2(loginUrl, clientId, redirectUri);
  ...
}

I've tried uninstalling/reinstalling jsforce, overriding the version of csv-parse and importing jsforce directly before I use it in my function

Any thoughts as to what is going wrong here, would be appreciated.

Upvotes: 2

Views: 273

Answers (0)

Related Questions