-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Currently the import object constructed for the `--target web` output only ever includes the current module as an one of the modules included. With `wasm-bindgen`'s optimization to import directly from modules, however, it's possible to have more modules imported from in the generated wasm file. This commit ensures that the imports are hooked up in the `--target web` es6 emulation mode, ensuring there aren't extraneous errors about import objects.
- Loading branch information
1 parent
c127ef7
commit 98ebbf6
Showing
4 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,3 +39,4 @@ fn can_log_html_strings() { | |
} | ||
|
||
pub mod snippets; | ||
pub mod modules; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function get_five() { | ||
return 5; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use wasm_bindgen::prelude::*; | ||
use wasm_bindgen_test::*; | ||
|
||
#[wasm_bindgen(raw_module = "./tests/headless/modules.js")] | ||
extern "C" { | ||
fn get_five() -> u32; | ||
} | ||
|
||
#[wasm_bindgen_test] | ||
fn test_get_five() { | ||
assert_eq!(get_five(), 2); | ||
} |