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

Online example is broken #1318

Closed
Vlad-Shcherbina opened this issue Mar 6, 2019 · 2 comments
Closed

Online example is broken #1318

Vlad-Shcherbina opened this issue Mar 6, 2019 · 2 comments
Labels

Comments

@Vlad-Shcherbina
Copy link
Contributor

The documentation page https://rustwasm.github.io/wasm-bindgen/examples/hello-world.html has a link "view the compiled example online".

This example does not work.

To reproduce

  1. Open https://rustwasm.github.io/wasm-bindgen/exbuild/hello_world/ in your browser.

Expected behavior

Hello world alert or whatever.

Actual behavior

Blank page, nothing happens. In the JS console there is the following message:

TypeError: Cannot read property '__wbindgen_malloc' of undefined
    at passStringToWasm (hello_world.js:66)
    at Module.greet (hello_world.js:77)
    at rust.then.m (index.js:7)
@alexcrichton
Copy link
Contributor

Thanks for the report! This was caused by #1295 due to its repurposing and breaking of the --browser flag unfortunately, although this breakage was unexpected. I'll see if I can take a look at a fix.

alexcrichton added a commit to alexcrichton/wasm-bindgen that referenced this issue Mar 7, 2019
This commit reverts part of the implementation of [RFC 6]. That RFC
specified that the `--browser` flag was going to be repurposed for the
new "natively loadable as ES module output", but unfortunately the
breakage is far broader than initially expected. It turns out that
`wasm-pack` passes `--browser` by default which means that a change to
break `--browser` would break all historical versions of `wasm-pack`
which is a bit much for now.

To solve this the `--browser` flag is going back to what it represents
on the current released version of `wasm-bindgen` (optimize away some
node.js checks in a few places for bundler-style output) and a new
`--web` flag is being introduced as the new deployment strategy.

[RFC 6]: rustwasm/rfcs#6

Closes rustwasm#1318
alexcrichton added a commit to alexcrichton/wasm-bindgen that referenced this issue Mar 7, 2019
This commit reverts part of the implementation of [RFC 6]. That RFC
specified that the `--browser` flag was going to be repurposed for the
new "natively loadable as ES module output", but unfortunately the
breakage is far broader than initially expected. It turns out that
`wasm-pack` passes `--browser` by default which means that a change to
break `--browser` would break all historical versions of `wasm-pack`
which is a bit much for now.

To solve this the `--browser` flag is going back to what it represents
on the current released version of `wasm-bindgen` (optimize away some
node.js checks in a few places for bundler-style output) and a new
`--web` flag is being introduced as the new deployment strategy.

[RFC 6]: rustwasm/rfcs#6

Closes rustwasm#1318
@alexcrichton
Copy link
Contributor

Ok should be fixed in #1328!

alexcrichton added a commit to alexcrichton/wasm-bindgen that referenced this issue Mar 7, 2019
This commit reverts part of the implementation of [RFC 6]. That RFC
specified that the `--browser` flag was going to be repurposed for the
new "natively loadable as ES module output", but unfortunately the
breakage is far broader than initially expected. It turns out that
`wasm-pack` passes `--browser` by default which means that a change to
break `--browser` would break all historical versions of `wasm-pack`
which is a bit much for now.

To solve this the `--browser` flag is going back to what it represents
on the current released version of `wasm-bindgen` (optimize away some
node.js checks in a few places for bundler-style output) and a new
`--web` flag is being introduced as the new deployment strategy.

[RFC 6]: rustwasm/rfcs#6

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

No branches or pull requests

2 participants