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

Support JS environments without code generation #1772

Closed
1 task done
benjavicente opened this issue Dec 17, 2024 · 1 comment
Closed
1 task done

Support JS environments without code generation #1772

benjavicente opened this issue Dec 17, 2024 · 1 comment

Comments

@benjavicente
Copy link

Report

Probably is related to #1507

Problem

The yoga-layout JavaScript library isn't compatible with environments that disallow code generation (eval), like Cloudflare's workerd (example related issue). Because of that, a library that patched how the wasm was loaded took off: yoga-wasm-web (used on satory). This split isn't great for libraries that use yoga and would like to target all modern JS environments, especially since yoga-wasm-web is stuck in yoga 2-beta.

Proposed solution

Support multiple ways to load wasm, like with a new entry point similar to yoga-wasm-web. But, since some libraries were built without the consideration that this option could be added, it might be better to provide a mechanism to globally configure how wasm is loaded before the initialization of libraries that use yoga:

import { setWASMLoader } from 'yoga-layout/load';

setWASMLoader((...) => WebAssembly.instantiate(...))

import { ... } from "@react-pdf/renderer" // or any other lib
@NickGerleman
Copy link
Contributor

NickGerleman commented Dec 24, 2024

I think this is mostly a dupe of #1767

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