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

WASM hot module reload #2688

Closed
wants to merge 8 commits into from
Closed

Conversation

cktang88
Copy link

↪️ Pull Request

Enables hot module reload for WASM.
Closes #2453

💻 Examples

🚨 Test instructions

We used https://github.com/jamiebuilds/parcel-rust-example to test HMR.

✔️ PR Todo

  • Added/updated unit tests for this change
  • Filled out test instructions (In case there aren't any unit tests)
  • Included links to related issues/PRs

bencooper222 and others added 6 commits February 24, 2019 01:45
Co-authored-by: Ben Cooper <bencooper222@gmail.com>
Co-authored-by: Kwuang Tang <arctangent20@yahoo.com>
Co-authored-by: Chris bell <chrisbelldevelopment@gmail.com>
This changes the hmr-runtime to update asynchronously, as the wasm runtime runs
asynchronously.

Co-authored-by: Ben Cooper <bencooper222@gmail.com>
Co-authored-by: Kwuang Tang <arctangent20@yahoo.com>
Co-authored-by: Chris Bell <chrisbelldevelopment@gmail.com>
Browsers without promise support and bundles without wasm will use the old
synchronous style

Co-authored-by: Ben Cooper <bencooper222@gmail.com>
Co-authored-by: Kwuang Tang <arctangent20@yahoo.com>
Co-authored-by: Chris Bell <chrisbelldevelopment@gmail.com>
Co-authored-by: Ben Cooper <bencooper222@gmail.com>
Co-authored-by: Kwuang Tang <arctangent20@yahoo.com>
Co-authored-by: Chris Bell <chrisbelldevelopment@gmail.com>
for (var i = 0; i < len; ++i)
bytes[i] = binStr.charCodeAt(i);

return WebAssembly.instantiate(bytes).then(function(wasmModule) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Synchronous Wasm instantiation and inlining the file content is really not ideal. It's recommend to use instantiateStreaming, is there any blocker to use it even for hmr?

@DeMoorJasper
Copy link
Member

Gonna close this as parcel 1 is in maintenance mode and this has been inactive for quite some time. Still a great reference for future work in Parcel 2, thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants