Skip to content
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

[SDK-43] Re-work the build system and compiled artifacts for @wasmer/sdk #371

Open
Michael-F-Bryan opened this issue Dec 15, 2023 · 1 comment
Assignees
Labels
JS linear Created by Linear-GitHub Sync

Comments

@Michael-F-Bryan
Copy link
Contributor

Michael-F-Bryan commented Dec 15, 2023

We currently allow users to import two different versions of the @wasmer/sdk package,

  • @wasmer/sdk - a slim version which tries to fetch() the wasmer_js_bg.wasm file at runtime
  • @wasmer/sdk/WasmerSDKBundled - a fat version where wasmer_js_bg.wasm has been stored in the compiled *.js file as a base64 string

We also produce these versions of the package in 3 different module formats,

  • UMD
  • CommonJS
  • ES Modules

This causes quite a few usability problems.

The biggest one is that, out of the box, you can almost never get @wasmer/sdk to load the right wasmer_js_bg.wasm file because of bundler weirdness, so the package becomes unusable without a lot of hacking.

I think we should change it so the bundled version is the default and people can import @wasmer/sdk/slim if they want to use the thin version. That will also give us a chance to mess around with the "slim" version a bit more without pushing out releases that break the package for everyone.

We might also want to consider switching to vite and using their ?url imports rather than depending on rollup or assuming where the wasmer_js_bg.wasm file will be placed by the end user's bundler.

A good resource for doing this sort of thing is Recommendations when publishing a Wasm library

CC: @syrusakbary

SDK-43

@Michael-F-Bryan Michael-F-Bryan added the linear Created by Linear-GitHub Sync label Dec 15, 2023
@Michael-F-Bryan Michael-F-Bryan self-assigned this Dec 15, 2023
Copy link

linear bot commented Dec 15, 2023

@Michael-F-Bryan Michael-F-Bryan changed the title Re-work the build system and compiled artifacts for @wasmer/sdk [SDK-42] Re-work the build system and compiled artifacts for @wasmer/sdk Dec 15, 2023
@Michael-F-Bryan Michael-F-Bryan changed the title [SDK-42] Re-work the build system and compiled artifacts for @wasmer/sdk [SDK-43] Re-work the build system and compiled artifacts for @wasmer/sdk Dec 15, 2023
@Michael-F-Bryan Michael-F-Bryan added the JS label Dec 19, 2023 — with Linear
@linear linear bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2024
@syrusakbary syrusakbary reopened this Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JS linear Created by Linear-GitHub Sync
Projects
None yet
Development

No branches or pull requests

2 participants