XeroAPI / xero-node

Xero Node SDK for OAuth 2.0 generated from XeroAPI/Xero-OpenAPI
http://developer.xero.com/
MIT License
197 stars 159 forks source link

Cannot compile: #654

Closed grmatthews closed 11 months ago

grmatthews commented 11 months ago

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:

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:

  1. npm install xero-node
  2. 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

github-actions[bot] commented 11 months ago

PETOSS-364

github-actions[bot] commented 11 months ago

Thanks for raising an issue, a ticket has been created to track your request

grmatthews commented 11 months ago

My mistake. Realised code is meant to be called server-side