next.js
a24462d9 - Replace wasmer with wasmtime for SWC plugin WASM engine (#91533)

Commit
27 days ago
Replace wasmer with wasmtime for SWC plugin WASM engine (#91533) ## What? Replace wasmer with wasmtime as the WASM runtime for SWC plugins. ## Why? - Wasmer has been a source of build complexity due to conflicting feature flags (`wasmer/default` vs `wasmer/js-default`) and large binary size - Wasmtime is actively maintained by the Bytecode Alliance with better performance and smaller footprint - The upstream SWC project already provides `swc_plugin_backend_wasmtime` on crates.io, so we can use it directly instead of maintaining our own implementation ## How? - Use the upstream `swc_plugin_backend_wasmtime` v9.0.0 crate from crates.io instead of a custom local implementation - Replace `swc_core/plugin_transform_host_native` (which pulls in wasmer via `__plugin_transform_env_native`) with granular features: `__plugin_transform_host` + `__plugin_transform_host_schema_v1` - Provide `WasmtimeRuntime` explicitly in both the NAPI bindings and turbopack plugin paths - Remove all direct `wasmtime`/`wasmtime-wasi` workspace dependencies — the upstream crate manages its own wasmtime version - Replace wasmer-related release profile size optimizations with equivalent wasmtime ones (`swc_plugin_backend_wasmtime`, `swc_plugin_runner`, `wasmtime`, `wasmtime-internal-cranelift`) - Pin `vergen = "=9.0.6"` to avoid a `vergen-lib` version conflict with `vergen-gitcl` 1.0.8 ## Binary size impact (darwin-arm64, compared against current canary) | Metric | Canary | Wasmtime (this PR) | Delta | |---|---|---|---| | Unstripped dylib | 133.1 MB | 128.2 MB | **-5.0 MB (-3.7%)** | | Stripped | 91.2 MB | 86.9 MB | **-4.3 MB (-4.8%)** | | Stripped + gzip (npm) | 30.9 MB | 29.4 MB | **-1.5 MB (-5.0%)** | <!-- NEXT_JS_LLM_PR -->
Author
Parents
Loading