Experiment: Making a JavaScript API for handlebars in WebAssembly (WIP)
This is an experiment for making a JavaScript API for handlebars wasm. The result is expected as similar as original handlebarsjs library.
I'm using this setup https://medium.com/@ianjsikes/get-started-with-rust-webassembly-and-webpack-58d28e219635 to compile. As of 2017-06-24, Chromium 59.0.3071.109, Firefox 54 and emscripten 1.37.14, I'm getting this error when call my compile function:
Uncaught (in promise) RuntimeError: memory access out of bounds
at _free (<WASM>[10741]+71)
at ___rust_deallocate (<WASM>[10589]+11)
at __ZN5alloc4heap10deallocate17hf3dde7510a423132E (<WASM>[1433]+82)
at __ZN73__LT_alloc__raw_vec__RawVec_LT_T_GT__u20_as_u20_core__ops__drop__Drop_GT_4drop17ha752346b60305a9dE (<WASM>[1631]+210)
at __ZN4core3ptr13drop_in_place17h9359bd02a9689a59E (<WASM>[1132]+38)
at __ZN4core3ptr13drop_in_place17h1a7890a117fe321dE (<WASM>[1086]+140)
at __ZN4core3ptr13drop_in_place17h01dc571daf330272E (<WASM>[1070]+38)
at _compile (<WASM>[1817]+1296)
at Module._compile (http://127.0.0.1:8080/build/bundle.js:19509:83)
at eval (eval at cwrap (http://127.0.0.1:8080/build/bundle.js:13901:12), <anonymous>:13:28)
Any update on this?
@dbousamra handlebars now compiles on webassembly. But a JavaScript API is not ready. If you are interested I can offer help for you to hack on it.
@sunng87 thanks for getting back to me.
I came across this project, because we are running into some performance issues with handlebars-js (used within a nodejs backend), and were considering using handlebars-rust, via a JS API, as a stop gap to buy us some more time.
@dbousamra if you are on nodejs, perhaps handlebars-rust can be loaded as a native dependency, instead of webassembly module. Libraries like neon may help.