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

Option to embed .wasm as a base64 string in JavaScript file #3570

Closed
mseele opened this issue Aug 25, 2023 · 1 comment
Closed

Option to embed .wasm as a base64 string in JavaScript file #3570

mseele opened this issue Aug 25, 2023 · 1 comment

Comments

@mseele
Copy link

mseele commented Aug 25, 2023

Motivation

Embed the .wasm file as a base64 string in JavaScript (like described here and requested in wasm-pack two times: rustwasm/wasm-pack#831 & rustwasm/wasm-pack#1074).
This would be useful in scenarios where the JS engine is embedded as a scripting environment as the concept of "reading files from disk" does not work.
Another useful example is packaging the js code into a single file with esbuild, e.g. for aws lambda.

Proposed Solution

Let's add a new --inline option that will embed the .wasm file as a base64 string in JavaScript.

Alternatives

I don't have a good alternative right now. If anyone has a better idea, please comment.

@daxpedda
Copy link
Collaborator

I don't see us adding both features in wasm-bindgen, because it can be done externally.

Unfortunately the Web is a platform with extremely diverse needs, so I'm generally against implementing a solution to every possible requirement out there and would rather see wasm-bindgen enabling other tools to be built around it, e.g. wasm-pack.

If wasm-bindgen has issues supporting external solution to this problem I'm more then happy to review a PR fixing or implementing something towards that.

@daxpedda daxpedda closed this as not planned Won't fix, can't repro, duplicate, stale Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants