Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot compile: #654

Closed
grmatthews opened this issue Nov 6, 2023 · 3 comments
Closed

Cannot compile: #654

grmatthews opened this issue Nov 6, 2023 · 3 comments

Comments

@grmatthews
Copy link

grmatthews commented Nov 6, 2023

SDK you're using (please complete the following information):

Describe the bug
Browser shows this error message in my [email protected] 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

  • 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.
Copy link

github-actions bot commented Nov 6, 2023

PETOSS-364

Copy link

github-actions bot commented Nov 6, 2023

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

@grmatthews
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant