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

Devex: Default vite config to support using local build of crypto wasm #3038

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

Conversation

BillCarsonFr
Copy link
Member

Quick vite config to support running a local build of the crypto-wasm library.

Copy link
Contributor

@toger5 toger5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx.
Any chance we can have some docs on how to do this in general?
Does the js-sdk include this documentation? If so a link to the correct section in the js-sdk docs would be enough. Otherwise a very short section in the readme would be nice I think?

Comment on lines +65 to +66
// Allow fs access to local build of wasm
"../matrix-rust-sdk-crypto-wasm/pkg",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every developer's file system and exact setup of linked packages could look different - for instance, I experience this same problem when I use a linked ../matrix-js-sdk package. I think the following, resolving the symlinks with realpath, would work for us both:

Suggested change
// Allow fs access to local build of wasm
"../matrix-rust-sdk-crypto-wasm/pkg",
// The crypto WASM module is imported dynamically. Since it's common
// for developers to use a linked copy of matrix-js-sdk or Rust
// crypto (which could reside anywhere on their file system), Vite
// needs to be told to recognize it as a legitimate file access.
await realpath(
"node_modules/matrix-js-sdk/node_modules/@matrix-org/matrix-sdk-crypto-wasm",
),

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A complication: that path might not exist if not using a linked copy of matrix-js-sdk. (because the dependency will instead be hoisted to node_modules/@matrix-org/matrix-sdk-crypto-wasm)

@robintown
Copy link
Member

Does the js-sdk include this documentation?

I don't believe matrix-js-sdk tries to have any documentation today on how to use it with specific bundlers

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.

3 participants