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

Unable to use the library with Common js project #470

Open
Faisal-3389 opened this issue Dec 11, 2024 · 1 comment
Open

Unable to use the library with Common js project #470

Faisal-3389 opened this issue Dec 11, 2024 · 1 comment

Comments

@Faisal-3389
Copy link

I tried using the library as recommened in my CJS project

If you're using CommonJS, the module can be loaded asynchronously using const wally = await import('wallycore') or import('wallycore').then(wally => { ... }).

but i fails with
require() of ES Module /node_modules/wallycore/src/index.js from .../createLBTCDepositAddress.ts not supported.\nInstead change the require of index.js in ./createLBTCDepositAddress.ts to a dynamic import() which is available in all CommonJS modules.

I tried using esbuild to import the project as cjs module but it is not able to convert due to
✘ [ERROR] Top-level await is currently not supported with the "cjs" output format

Is there a recommended way to use it in the CJS node project, or any example project i can follow. please let me know, thank you!

@jgriffiths
Copy link
Contributor

Hi @Faisal-3389

I'm not sure of your exact setup, but that error seems to be a common error when using CJS. Can you check out the advice in the following links and see if it helps?

If you are able to resolve the issue please let me know what worked and I will update the documentation...

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

2 participants