-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Loading Multiple WASM bundles in the same Page #2700
Comments
I think the best solution here would be to get ES modules working since they'd contain their global state, but if not workable I think that the |
Thank you, I suspect that flag will do the trick. I will be testing that tomorrow. |
Debugging out loud:
|
The |
That was indeed the fix, I just needed a way to access that flag through |
Summary
Lately I've been developing a browser extension entirely in Rust/WASM. Today for the first time I attempted to load multiple Content Scripts into the same page. Normally this is not a problem, so long as the the following is kept in mind:
When I noticed that the second script failed to load, I wondered why. Then I found my browser complaining to me that:
Citing:
that appears in the JS output of
wasm-pack
. Since I'm using two WASM bundles, and thus two JS shims, these symbols are thus clashing in the same namespace.Question: Is there a way to obfuscate that symbol name at compile-time in order to avoid the symbol clash? Or are there deeper concerns within the
wasm-bindgen
world that require that symbol to be named exactlywasm_bindgen
? Or perhaps am I overlooking something obvious in how I should be loading these bundles? Otherwise, it doesn't seem possible to load more than one WASM bundle per page, which doesn't sound right.Please and thank you.
Additional Details
Note that I am compiling with
--no-modules
for technical reasons. I am also loading the WASM manually in my own shim script like:because inlined JS (i.e.
<script>
tags) is not allowed in HTML of browser extensions. Presumably I'd have to use the obfuscated name here too.The text was updated successfully, but these errors were encountered: