Skip to content

fix: ensure wasm module matches frontend build#101

Merged
Myriad-Dreamin merged 1 commit intoMyriad-Dreamin:mainfrom
kxxt:fix/match-wasm
Mar 29, 2025
Merged

fix: ensure wasm module matches frontend build#101
Myriad-Dreamin merged 1 commit intoMyriad-Dreamin:mainfrom
kxxt:fix/match-wasm

Conversation

@kxxt
Copy link
Contributor

@kxxt kxxt commented Jan 17, 2025

The frontend is built against the typst_ts_renderer_bg.wasm installed in node_modules. However, the cli ships a prebuilt typst_ts_renderer_bg.wasm from https://github.com/Myriad-Dreamin/typst/tree/assets-book-v0.2.0 . This mismatch can cause wasm load failures(#100).

This PR fixes it by copying the wasm module from node_modules to ensure a single source of truth for typst_ts_renderer_bg.wasm.

Fix #100

@Myriad-Dreamin
Copy link
Owner

Myriad-Dreamin commented Jan 18, 2025

Thank you for contribution. It should help develop with locally built WASM. The weird point is that we want to make cargo install https://github.com/Myriad-Dreamin/shiroa work, so we are shipping the WASM binary with the git submodule. I find it is not satisfied but I have no clue how we should go:

  1. continue using git submodule
  2. bundle the assets in some crate and upload them to crates.io
  3. don't allow cargo install https://github.com/Myriad-Dreamin/shiroa anymore.

@kxxt
Copy link
Contributor Author

kxxt commented Jan 19, 2025

The weird point is that we want to make cargo install https://github.com/Myriad-Dreamin/shiroa work, so we are shipping the WASM binary with the git submodule. I find it is not satisfied but I have no clue how we should go:

1. continue using git submodule

2. bundle the assets in some crate and upload them to crates.io

3. don't allow `cargo install https://github.com/Myriad-Dreamin/shiroa` anymore.

I think there is another way to go but it would require users to have yarn installed on their machine.

We can remove the independent build script and build the frontend in build.rs. POC: cargo install --git https://github.com/kxxt/shiroa --branch build-frontend-in-build.rs

kxxt@1453507

@Myriad-Dreamin
Copy link
Owner

Sorry I don't know the reason but I thought you requested to merge kxxt@1453507. I think it is okay to copy the wasm module in build-from-source.

@Myriad-Dreamin Myriad-Dreamin merged commit 7ff932c into Myriad-Dreamin:main Mar 29, 2025
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.

shiroa.js failed to load LinkError: import object field '__wbindgen_closure_wrapper1668' is not a Function

2 participants