Getting compile error in Javascript/React/Node app when attempting to import XeroClient (or any xero class)

31 Views Asked by At

As soon as I add this into a jsx file and save I get a compile error. This is with [email protected] installed. import { XeroClient } from "xero-node"

The compile error is as follows:

` ERROR in ./node_modules/@panva/asn1.js/lib/asn1/base/node.js 3:4-21 Module not found: Error: Can't resolve 'assert' in 'C:\dev\j4j\app-02\node_modules@panva\asn1.js\lib\asn1\base'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "assert": require.resolve("assert/") }' - install 'assert' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "assert": false } ERROR in ./node_modules/asn1/lib/ber/reader.js 3:13-30 Module not found: Error: Can't resolve 'assert' in 'C:\dev\j4j\app-02\node_modules\asn1\lib\ber'`

The million other packages I've installed don't have this error. Is this a problem with the xero-node package?

I was expecting 0 compile errors

0

There are 0 best solutions below