-
Notifications
You must be signed in to change notification settings - Fork 9
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
Use asynchronous wasm instantiation methods where possible #174
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fixed the tsconfig so that tsc
actually check JS files in #176. You should probably rebase on that and check that everything typechecks
Will do, but you need to fix the CI for it first ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
I've merged #176, I merged back main on this PR fixing the conflicts |
instance.exports.__wbindgen_start(); | ||
initialised = true; | ||
return instance.exports; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was rather thinking that returning this here would reduce the number of @ts-expect-error
s we needed, but 🤷
... because I keep getting confused
Currently, every call to `loadModuleSync` or `loadModuleAsync` in the node entry points has to be followed by a call to `initInstance`. This change moves that call into `loadModule[A]sync` instead. This (a) brings the node code more into line with the browser code; (b) lays groundwork for the future where I want to move bits of `initInstance` into `loadModule[A]sync`.
This fixes a problem on Chrome, which would complain about the module being too big. It also significantly simplifies the code on the browser entry points, because `instantiateStreaming` is widely supported.
9c45cdf
to
91ae6a2
Compare
This fixes a problem (introduced in #167) on Chrome, which would complain about the module being too big. It also significantly simplifies the code on the browser entry points, because
instantiateStreaming
is widely supported.