-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: Add support for WASM file format in assets in theme app extensions #3893
Comments
how would you use it in the frontend? |
Great question. The goal is client-side calculations of discounts. My app provides various logic conditions for when discounts should apply, and I'd prefer to have 1 single implementation that can be used in multiple places. |
You can already do this, by just hosting your WASM elsewhere. I'd be quite careful whilst doing this. WASM can be compressed very well (normally up to 50%), but you'd still be looking at sticking a ~50kb file in the storefront. The better approach is sadly to re-write the logic in Javascript, IMO. There are other big issues as well. With Discount Kit, we run the WASM as an endpoint which can then be called from the storefront. We are working on a significantly better approach which I can share in future. |
@bkspace Thanks for your response. I'll probably stick with having a separate TS implementation, which gets built into the theme app extension. That way, I don't have to host it on my server. |
Hi @thosakwe, just checking you're aware that you can build functions in JavaScript/TypeScript? |
Ah, sorry, I missed the reference to the other issue. @nickwesselman is there anything to update about performance improvements? I wonder if this is just going to be a temporary issue anyway, and if JS will be sufficiently performant soon, then this will become a non-issue. |
Yes, thanks for your response. Unfortunately, JS/TS Functions aren't viable for my use case (due to Shopify/function-examples#329), which is why I ported it to Rust. |
This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. P.S. You can learn more about why we stale issues here. |
👋 Hi @thosakwe! Thanks for this suggestion. We've implemented WASM file support for theme app extension assets. This change should be available in the next minor release. 🎉 (I saw you commented on the change itself, but am commenting here as well for visibility). |
What area(s) will this request affect?
App, Extension, Function
What type of change do you want to see?
New feature
Overview
Please add
.wasm
to the allow list of file type extensions in theme app extensions.Motivation
Due to Shopify/function-examples#329, I had to port my Shopify Functions to Rust.
However, my app customers heavily requested to be able to use it on the storefront as well.
Initially, I wanted to reuse my Rust code in the form of a
.wasm
binary in my theme app extensions (which is, in theory, the main use case of WebAssembly).However, because theme app extensions only allow specific files to be included assets, this is impossible, so I currently have 2 separate implementations of my logic: one in Rust, and another in TypeScript.
This leads to duplicate effort when building apps on top of Shopify's latest APIs.
The text was updated successfully, but these errors were encountered: