rhaiscript / playground

A Rhai scripting playground that runs Rhai scripts using WebAssembly in a web browser.
https://rhai.rs/playground
MIT License
20 stars 5 forks source link

WebAssembly binary is duplicated and mangled differently for web and webworker targets #1

Closed alvinhochun closed 4 years ago

alvinhochun commented 4 years ago

When the WASM module is used on both the web and web worker targets, webpack decides to generates two .wasm files with their exports mangled in just slightly different ways for each of them. This leads to the client having to download the same WASM module twice.

Can we stop webpack from doing this?

Code: https://github.com/alvinhochun/rhai-playground/tree/webworker-test

schungx commented 4 years ago

When "Run" is pressed for the first time, it waits to load the WASM again, which takes time. With a slow Internet it looks like the UI is not doing anything.