andreiltd opened PR #14396 from andreiltd:fix-stub-aliases to bytecodealliance:main:
I have this use case where I use
wizerto initialize JS component. During the initialization JS engine requires realwasiimplementation but application defined imports should trap when called and their real implementation should be provided later when the component is running.So far I was able to achieve this by keeping the following calls order: trap first and then register wasi. That approach is not working anymore after https://github.com/bytecodealliance/wasmtime/pull/13908 and I'm getting:
instance export error has the wrong typeThis fix remembers which resource has already been visited and skips placeholder for that alias. The type checker then resolv each alias to the original resource.
andreiltd requested cfallin for a review on PR #14396.
andreiltd requested wasmtime-core-reviewers for a review on PR #14396.
alexcrichton unassigned cfallin from PR #14396 Preserve resource aliases when stubbing unknown imports.
alexcrichton requested alexcrichton for a review on PR #14396.
:thumbs_up: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
I believe that the code in this PR is probably correct, but I find the comment here a bit confusing -- could this be replaced with this instead?
The first definition of a resource needs to be present, but all other future references to the same resource are aliases of the original resource definition. Once a resource is visited here all future hits on the same resource shouldn't do anything else effectively. If
item_nameis already defined then we'll bail out in the belowmatches!, and otherwise a stub will be inserted, so no matter what the first resource is defined and all others willrefer to that.
fitzgen added the label wasm-proposal:component-model on PR #14396.
github-actions[bot] added the label wasmtime:api on PR #14396.
andreiltd updated PR #14396.
alexcrichton added PR #14396 Preserve resource aliases when stubbing unknown imports to the merge queue.
:check: alexcrichton merged PR #14396.
alexcrichton removed PR #14396 Preserve resource aliases when stubbing unknown imports from the merge queue.
Last updated: Oct 11 2026 at 04:10 UTC