rust-native-wasm-loader
rust-native-wasm-loader copied to clipboard
Hot Reload Support
trafficstars
I would really like to see one of these new WASM compilers include Hot Reload Support. I tried this and it crashes. Is there anything that I can do to make this work with hot reload? I have some ideas for simpler programs...
A trivial approach would be to simply strip the rusty types then transform it into more javascripty language...
string
.replace(/extern.*;/gm, '')
.replace(/use.*;/gm, '')
.replace(/#\[.*\]/gm, '')
.replace(/eprintln!/gm, 'console.log')
.replace(/extern (.|\n)[^}]*\}/gm, '')
.replace(/pub fn (\w*)/gm, 'module.exports.$1 = function $1')
.replace(/{.[^}]*}/gm, '%s')
.replace(/\) -> \w* {/gm, '){')
.replace(/: (i32|f32)/gm, '')
.replace(/eprintln!/gm, 'console.log')
.replace(/^(\s[^\n]*)\n}/gm, 'return $1; }')
.replace(/(\s|\n)(\s*)/gm, ' ');
Do you know if this is possible?!?!?
I just wish we could sorta run things exactly the same in development as production without having to worry about comment things out in development.