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

chore(web-client): fix default comlink import in node #3278

Open
wants to merge 1 commit into
base: albatross
Choose a base branch
from

Conversation

onmax
Copy link
Member

@onmax onmax commented Feb 8, 2025

What's in this pull request?

The current import does not work and when we try to use web client in node will result in an error.

comlink does not have export default, and instead we should use import * as Comlink from 'comlink' like we do in other files. For example bundle.js

@sisou sisou self-requested a review February 9, 2025 21:12
@sisou sisou self-assigned this Feb 9, 2025
@sisou
Copy link
Member

sisou commented Feb 10, 2025

I'm using NodeJS v20, and for me the example in web-client/example/node works as is:

Can you please try out the example (run index.mjs) and report if it works with your Node version?

If it does, let me know in which context and how you are using the lib in Node that doesn't work.

@onmax
Copy link
Member Author

onmax commented Feb 10, 2025

I get this error when running maxi@Maxi:~/nimiq/core-rs-albatross/web-client$ ./scripts/build.sh --only nodejs,types.

Do I need to compile something before running ./script/build.sh?

error[E0463]: can't find crate for `core`
  |
  = note: the `wasm32-unknown-unknown` target may not be installed
  = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `subtle` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for `std`
  |
  = note: the `wasm32-unknown-unknown` target may not be installed
  = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`

error: could not compile `cfg-if` (lib) due to 1 previous error
error: could not compile `once_cell` (lib) due to 1 previous error
error: could not compile `byteorder` (lib) due to 1 previous error
error: could not compile `const-oid` (lib) due to 1 previous error
error: could not compile `typenum` (lib) due to 1 previous error
error: could not compile `pin-project-lite` (lib) due to 1 previous error
error: could not compile `memchr` (lib) due to 1 previous error

@sisou
Copy link
Member

sisou commented Feb 10, 2025

Well, tells you right there in the message.

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

Successfully merging this pull request may close these issues.

2 participants