-
Notifications
You must be signed in to change notification settings - Fork 359
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
Create a bundle for browsers that includes the Wasm code? #408
Comments
Hey there!
I 100% agree with you there. Before I potentially go the wrong direction, would the module also be "completely hide" the bundle's existance? When you say "For browsers" and "For Node.js", is what you have in mind
|
Ah, good point! Tricky to get this right. Ideas:
|
I think for me, since this is published on That all makes me lean toward the default being a base64-encoded WASM included in the npm package by default to avoid the loader. We could certainly try to expose ways to configure it manually, but I think that gets complicated quickly, especially once it is used as a subdependency instead of a direct dep. |
Base64, stored in a CommonJS module? Sounds good! The more transparent, the better, IMO. If it can be overridden, then it doesn’t matter if that’s a little slower. Must people will just appreciate that it’s easier to use. Bonus: it’s easier to migrate to something else in the future (to a first-class Wasm module, away from Wasm, etc.). |
it's somewhat coincidence but #369 takes same approach for b64 encoded binary, and makes isomorphic module publishing easier. |
Could encode it more densely with ascii85: Or z85: |
From my experience, if 25% size increase is not deadly critical, loading "small" wasm from base64 string is optimal (simple & fast enough). |
@rauschma i just accidentally, independently reinvented your test: /\.wasm$/,
type: 'javascript/auto',
use: [
{
loader: 'arraybuffer-loader',
},
], technique to bundle and include so, in short: as a first step to support people -- like myself and @rauschma -- bundling then, thereafter, i too wholly support bundling zooming out, I'm curious: why is cc @loganfsmyth |
Suggestion: source-map would be easier to use if it completely hid the fact that it internally uses Wasm.
webpack.config.js
:Setup code (when used outside the library):
AFAICT,
.initialize()
is not in the.d.ts
file. Maybe add it?The text was updated successfully, but these errors were encountered: