Skip to content

take the default export from wasm#3200

Closed
airinterface wants to merge 1 commit intowasm-bindgen:mainfrom
airinterface:pickupDefaultExportAsWasm
Closed

take the default export from wasm#3200
airinterface wants to merge 1 commit intowasm-bindgen:mainfrom
airinterface:pickupDefaultExportAsWasm

Conversation

@airinterface
Copy link
Copy Markdown

importing * as wasm

.wasm file generated exporting as a default object.
creates default package to be name as a attribute 'default' in the imported wasm object.
in that it will cause function error was.greet not defind, while function is t here in wasm.default.greet for example.

@Liamolucko
Copy link
Copy Markdown
Contributor

wasm-bindgen's bundler target aims to be compatible with the ESM integration proposal, which makes each WebAssembly export into a top-level export of the ES module. That's why it generates import * as wasm from ..., because a wasm export foo should then be available as wasm.foo according to the proposal.

You haven't said specifically which build tool it is that puts all of the wasm module's exports inside the default export and needs this PR, but it's intentionally not supported by wasm-bindgen, because it doesn't conform to the standard that we're following for how importing from wasm modules should work.

@Liamolucko Liamolucko closed this Dec 20, 2022
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.

2 participants