[BUG] Regression in 0.8.0: Can’t use `#[event(start)]` without a direct `wasm-bindgen` dependency
### Is there an existing issue for this?
- [x] I have searched the existing issues
### What version of `workers-rs` are you using?
0.8.0
### What version of `wrangler` are you using?
n/a
### Describe the bug
After upgrading to v0.8, a start handler like this:
```rust
#[event(start)]
pub fn setup_hook() {
// …
}
```
in a crate that does not have `wasm-bindgen` as a dependency, will fail to compile:
```
error[E0433]: cannot find module or crate `wasm_bindgen` in this scope
--> lib.rs:LL:1
|
LL | #[event(start)]
| ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `wasm_bindgen`
|
= note: this error originates in the attribute macro `event` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0433`.
error: could not compile `generate-newspaper-entry` (lib) due to 1 previous error
```
This is a consequence of [this change](https://github.com/cloudflare/workers-rs/commit/e363ba6#diff-5fbccf7aad8fecebdb79b59bcdf993ad2236c34b9360b7f6cc2862374497a610) where the import of `::worker::wasm_bindgen` was dropped.
### Steps To Reproduce
Cargo.toml
```toml
[package]
name = "issue-973"
version = "0.1.0"
edition = "2024"
[lib]
crate-type = ["cdylib"]
[dependencies]
# Only `worker` — no direct `wasm-bindgen` dependency.
# The `#[event(start)]` macro should re-export what it needs
# via `::worker::wasm_bindgen`, but since 0.8.0 it doesn't.
worker = "0.8.0"
```
src/lib.rs
```rust
use worker::event;
// Fails to compile with worker 0.8.0 because the `event` macro
// emits a bare `wasm_bindgen` reference instead of `::worker::wasm_bindgen`.
#[event(start)]
pub fn setup_hook() {}
```
关闭于 2026-04-13 0 条评论