# wasm: Only generate import when referenced · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/97448e4d5f6a4c1f9eb7ed11d8b147c0883168c2)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 97448e4d5f6a4c1f9eb7ed11d8b147c0883168c2

Requested commit: 97448e4d5f6a4c1f9eb7ed11d8b147c0883168c2

Commit: 97448e4d5f6a4c1f9eb7ed11d8b147c0883168c2

Tree: 495b5cc0474e3fa7e0f4819d899b2ac436596961

Author: Luuk de Gram

Committer: Luuk de Gram

## Message

```
wasm: Only generate import when referenced

Rather than creating an import for externs on updateDecl, we now
generate them when they're referenced. This is required so using @TypeOf(extern_fn())
will not emit the import into the binary (causing an incorrect function type index
as it won't be fully analyzed).

```

## Parents

- [af844931b2600e50e586436dee0d607d67ed9ff2](https://git.cafe/gitcafe/zig/commit/af844931b2600e50e586436dee0d607d67ed9ff2?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/97448e4d5f6a4c1f9eb7ed11d8b147c0883168c2?format=markdown)
