Closed adomasven closed 5 years ago
Fortunately wasm-pack can do that. Did you try wasm-pack build --target no-modules
? If you can get away with ES Modules syntax for exports, then prefer --target web
, but either would be fine.
There's an example at https://rustwasm.github.io/docs/wasm-bindgen/examples/without-a-bundler.html. I've had a look at the output of no-modules
, and it is very ES5.
Be aware of the caveats of builds that don't use a bundler like Webpack, which might be relevant. https://rustwasm.github.io/docs/wasm-bindgen/reference/browser-support.html (Also, you could always just slap Webpack in your build pipeline, right? One day!)
Fortunately wasm-pack can do that. Did you try
wasm-pack build --target no-modules
? If you can get away with ES Modules syntax for exports, then prefer--target web
, but either would be fine.
Oh right, thanks. Would be great if you put more details about this in README.md
.
Refer to the docs for on how to get the output you need, particularly --target.
I updated it right after you last checked in.
Ah, I was looking under https://github.com/cormacrelf/citeproc-rs/tree/master/crates/wasm
The current wasm JS bindings use the new nodejs wasm
import
syntax. At the moment this is not available in most environments, including browsers, older nodejs versions and the XPCOM environment Zotero is currently running in.Could you provide an alternative API to supply the wasm bytecode for use with the
WebAssembly
API to the binding JS module, so that the citeproc-rs embedding application can use whatever API is available for them to load it?