Open DougAnderson444 opened 1 year ago
Ideally it would be possible to do everything in the browser such that a separate build step for users is not necessary. If that is not feasible a rollup plugin would be fine with me. I don't have any experience with rollup though so I don't know how easy it would be for me to implement.
By the way do you know if browsers intend to support the component model in the (near) future?
Ideally it would be possible to do everything in the browser such that a separate build step for users is not necessary. If that is not feasible a rollup plugin would be fine with me. I don't have any experience with rollup though so I don't know how easy it would be for me to implement.
It can indeed all be done in the browser. Rollup can actually be run in the browser too! (Not many people know this).
So what we would have is: Import the component bytes, get loaded JS in the same page. No (non-browser) build step.
I'll see if I can whip up a Rollup plugin for these files.
So I wrote the Rollup Plugin 🚀
https://github.com/DougAnderson444/rollup-plugin-wit-component
Needs a bit of cleanup, polish, and a demo to show how to import a *.component.wasm
into the browser and use the functions. But it works =)
By the way do you know if browsers intend to support the component model in the (near) future?
I do not know. I suspect the answer is "not anytime soon."
@bjorn3 as I mentioned here https://github.com/bytecodealliance/jco/issues/42#issuecomment-1597139850 I think the way to go about supporting the component model is:
js-component-bindgen-component
<head><script>...
so it can be used by the window.