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

core: rxjs is not optional #1001

Open
1 of 4 tasks
klntsky opened this issue Nov 28, 2023 · 2 comments
Open
1 of 4 tasks

core: rxjs is not optional #1001

klntsky opened this issue Nov 28, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@klntsky
Copy link

klntsky commented Nov 28, 2023

Summary

I'm trying to initialize a project using @cardano-sdk/core and node fails

Steps to reproduce the bug

  1. Initialize a new npm package with npm & nodejs v18.18.2
  2. set type:module in package.json
  3. Add @cardano-sdk/core to the dependencies
  4. enter node repl and import it

Actual Result


[nix-shell:~/c/cjssdk-test]$ node --experimental-specifier-resolution=node
(node:2382229) ExperimentalWarning: The Node.js specifier resolution flag is experimental. It could change or be removed at any time.
(Use `node --trace-warnings ...` to show where the warning was created)
Welcome to Node.js v18.18.2.
Type ".help" for more information.
> const c = await import('@cardano-sdk/core')
Uncaught:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'rxjs' imported from /home/me/c/cjssdk-test/node_modules/@cardano-sdk/core/dist/esm/CardanoNode/util/bufferChainSyncEvent.js
    at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
    at new NodeError (node:internal/errors:405:5)
    at packageResolve (node:internal/modules/esm/resolve:890:9)
    at moduleResolve (node:internal/modules/esm/resolve:939:20)
    at defaultResolve (node:internal/modules/esm/resolve:1132:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18) {
  code: 'ERR_MODULE_NOT_FOUND'
}
>

Expected Result

Importing works

SDK version

0.21.0

Environment type

  • Node.js
  • Browser
  • Browser Extension
  • Other

Environment details

nodejs v18.18.2

@klntsky klntsky added the bug Something isn't working label Nov 28, 2023
@rhyslbw
Copy link
Member

rhyslbw commented Nov 29, 2023

Why is rxjs a peer dependency @mkazlauskas ?

@mkazlauskas
Copy link
Member

core package was supposed to only import types from rxjs in order to define ObservableCardanoNode interface, but clearly it's no longer the case. We should probably hoist bufferChainSyncEvent to projection package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants