You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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/sdkDec 15, 2023
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/sdkDec 15, 2023
We currently allow users to import two different versions of the
@wasmer/sdk
package,@wasmer/sdk
- a slim version which tries tofetch()
thewasmer_js_bg.wasm
file at runtime@wasmer/sdk/WasmerSDKBundled
- a fat version wherewasmer_js_bg.wasm
has been stored in the compiled*.js
file as a base64 stringWe also produce these versions of the package in 3 different module formats,
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 rightwasmer_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 onrollup
or assuming where thewasmer_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
The text was updated successfully, but these errors were encountered: