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

Future refactor: Remove circular imports #110

Open
cmdruid opened this issue Aug 20, 2024 · 2 comments
Open

Future refactor: Remove circular imports #110

cmdruid opened this issue Aug 20, 2024 · 2 comments

Comments

@cmdruid
Copy link

cmdruid commented Aug 20, 2024

Hello. I'm running into an issue where there's a circular import in this package that leads to rollup.js breaking when trying to bundle for the browser:

[!] Error: Circular dependency: node_modules/@scure/btc-signer/lib/esm/payment.js -> node_modules/@scure/btc-signer/lib/esm/psbt.js -> node_modules/@scure/btc-signer/lib/esm/transaction.js -> node_modules/@scure/btc-signer/lib/esm/payment.js
    at onwarn (file:///home/cscott/Projects/ducat/client-sdk/rollup.config-1724172435327.mjs:20:9)
    at /home/cscott/Projects/ducat/client-sdk/node_modules/rollup/dist/shared/rollup.js:655:13
    at /home/cscott/Projects/ducat/client-sdk/node_modules/rollup/dist/shared/rollup.js:641:32
    at Object.logger [as onLog] (/home/cscott/Projects/ducat/client-sdk/node_modules/rollup/dist/shared/rollup.js:1120:9)
    at Graph.sortModules (/home/cscott/Projects/ducat/client-sdk/node_modules/rollup/dist/shared/rollup.js:20637:26)
    at Graph.build (/home/cscott/Projects/ducat/client-sdk/node_modules/rollup/dist/shared/rollup.js:20545:14)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /home/cscott/Projects/ducat/client-sdk/node_modules/rollup/dist/shared/rollup.js:21146:13
    at catchUnfinishedHookActions (/home/cscott/Projects/ducat/client-sdk/node_modules/rollup/dist/shared/rollup.js:20698:16)
    at rollupInternal (/home/cscott/Projects/ducat/client-sdk/node_modules/rollup/dist/shared/rollup.js:21141:5)

I see that you have this commented in the code as a circular reference, do you have any plans to fix it in the future?

@paulmillr
Copy link
Owner

In a big future refactoring that would be nice to fix.

That seems like something rollup should handle. Perhaps your configuration is wrong. I've briefly searched and they seem to support circular imports.

@cmdruid
Copy link
Author

cmdruid commented Aug 21, 2024

Rollup isn't able to fix the circular references, but I looked into it more and the warning can be suppressed. I went ahead with that route, and hopefully the bundling works without issue. Thanks for the response and clarity.

@cmdruid cmdruid closed this as completed Aug 21, 2024
@paulmillr paulmillr reopened this Aug 21, 2024
@paulmillr paulmillr changed the title Circular import breaks bundling with rollup Future refactor: Remove circular imports Aug 21, 2024
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