FuelLabs / sway

🌴 Empowering everyone to build reliable and efficient smart contracts.
https://docs.fuel.network/docs/sway/
Apache License 2.0
62.58k stars 5.37k forks source link

Support compiling `sway-core` and `forc-pkg` to WASM? #3928

Open mitchmindtree opened 1 year ago

mitchmindtree commented 1 year ago

This is a bit of a moonshot issue and by no means a priority, but I've been meaning to open it for a while and would likely enable some pretty cool stuff (e.g. in-browser compilation, deploying from the browser, etc).

Some steps that come to mind in enabling this:


On a related note: cc @JoshuaBatty is doing something like this a requirement to support Sway in vscode.dev? Or they support native plugins somehow?

JoshuaBatty commented 1 year ago

I'm not sure just yet, @sdankel is going to look into this for the current milestone. In-browser compilation certainly sounds juicy though.

zees-dev commented 2 weeks ago

Having the same codebase/tooling work as CLI and in browser is pretty great.

We would need to first try ensure crates are no-std compliant. This may also require a slight restructure of the project such that the CLI code (specifically clap based code) is in a seperate crate to the core lib code. This way the libraries can transition to no-std compliancy first; then later target the WASM based target (wasm32-unknown-unknown).