SDK you're using (please complete the following information):
xero-node@4.36.0
Describe the bug
Browser shows this error message in my react@18.2.0 web app, instead of compiling if I have the following line of code uncomments
import { XeroClient } from "xero-node"
Browser error is:
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'
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/writer.js 3:13-30
Module not found: Error: Can't resolve 'assert' in 'C:\dev\j4j\app-02\node_modules\asn1\lib\ber'
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/assert-plus/assert.js 4:13-30
Module not found: Error: Can't resolve 'assert' in 'C:\dev\j4j\app-02\node_modules\assert-plus'
Did you mean './assert'?
Requests that should resolve in the current directory need to start with './'.
Requests that start with a name are treated as module requests and resolve within module directories (node_modules, C:\dev\j4j\app-02\node_modules).
If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.
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 }
To Reproduce
Steps to reproduce the behavior:
npm install xero-node
Add import { XeroClient } from "xero-node" into jsx page at top and save. Commenting out the line and saving gives you a clean compile
Expected behavior
No compile errors. Ability to use xero-node functions.
Screenshots
See browser compile error above
Additional context
I have lots of other imports no probs
Just going off the very first compile message shown above, not sure if this means anything but for this compiler message: Can't resolve 'assert' in 'C:\dev\j4j\app-02\node_modules\@panva\asn1.js\lib\asn1\base, if I go look in the 'base' folder I can see buffer.js, index.js, node.js, and reporter.js -- am I supposed to see assert.js in that folder too??
Not sure if relevant, but I am not using typescript.
SDK you're using (please complete the following information):
Describe the bug Browser shows this error message in my react@18.2.0 web app, instead of compiling if I have the following line of code uncomments
import { XeroClient } from "xero-node"
Browser error is:
To Reproduce Steps to reproduce the behavior:
Expected behavior No compile errors. Ability to use xero-node functions.
Screenshots See browser compile error above
Additional context