Webpack supports dynamic importing only for some special cases in which
it is able to narrow down the set of packages to bundled. In the
general case it just produces an empty (Webpack) context plus the
warning stating that "the request of a dependency is an expression."
Apparently the commit 120a1d7f changed the Javascript generated by
wasm-bindgen so that the binding for the `require` became:
```
module.require(getStringFromWasm0(arg0, arg1))
```
when it used to be:
```
getObject(arg0).require(getStringFromWasm0(arg1, arg2))
```
In the latter case Webpack did not even realize that this code imported
a package and, hence, did not try to bundle it. The new code triggers
the bundling and because the dependency is fully dynamic Webpack has
problems with it.
This commit reverts partially the commit 120a1d7f so that the generated
binding obfuscates the `require` call enough to hide it from Webpack
again.
This uses `process.versions.node` to see if we are in Node.js rather
than using `global.self` to check if we are in a Browser.
This change also makes some minor `wasm_bindgen` improvements:
- Use `js_sys::global()` to get the global object
- Bind the node require as `module.require`
- Improving error messages
Signed-off-by: Joe Richey <joerichey@google.com>
See #194
This uses the fact that `wasm32-unknown-unknown` is an "unsupported" target. This means we can use the `"custom"` feature to define a custom handler, and then write tests to make sure that function is called.
See #194
This installs (and caches) the emsdk toolchain at the last version compatible w/ stable rust. It also tests on both asmjs and wasm32, uses node by default, and works around an asm.js bug.
Most of the advantages from testing various Rust versions already come
from running those tests on Linux and Windows. There's very little
gain from also running these tests on macOS, while macOS jobs are the
slowest to schedule.
Signed-off-by: Joe Richey <joerichey@google.com>
- Cleanup `tests.yml`
- Add better binary downloads
- Add minimal dependancies check
- Add tests for `custom` feature
- Build/Link for iOS
- Run cross tests on aarch64 linux and Android
- Link on Solaris and Netbsd
- Test wasm code on Node, Chrome, Firefox
- Test WASI
- No need for RDRAND feature on VxWorks
Signed-off-by: Joe Richey <joerichey@google.com>
Point the build status badges to point to Github Actions
Add badges for:
- Downloads
- License
Fix formatting to make updating easier
Signed-off-by: Joe Richey <joerichey@google.com>