Skip to content

Commit c4114d5

Browse files
authored
refactor(plugin/runner): Switch wasmtime-wasi to wasi-common (#10979)
**Description:** Currently, `wasmtime-wasi` uses tokio `block_on` internally, which causes panic when used in the tokio runtime. I originally thought this could be solved by use `block_in_place`, but the large scope of `block_in_place` caused a serious performance regression (even without use plugin). see web-infra-dev/rspack#11303 (comment) Switch to `wasi-common` is a better choice, which simplifies the wasi implment and makes it independent of tokio.
1 parent a10dada commit c4114d5

File tree

10 files changed

+67
-169
lines changed

10 files changed

+67
-169
lines changed

.changeset/stupid-ligers-juggle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
swc_plugin_backend_wasmtime: major
3+
---
4+
5+
refactor(plugin/runner): Switch wasmtime-wasi to wasi-common

Cargo.lock

Lines changed: 26 additions & 128 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ resolver = "2"
125125
wasmer = { version = "6.1.0-rc.2", default-features = false }
126126
wasmer-wasix = { version = "0.601.0-rc.2", default-features = false }
127127
wasmtime = { version = "35", default-features = false }
128-
wasmtime-wasi = { version = "35", default-features = false }
128+
wasi-common = { version = "35", default-features = false }
129129

130130
foldhash = "0.1"
131131
precomputed-map = "0.2"

crates/swc_plugin_backend_tests/tests/css-plugins/swc_noop_plugin/Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/swc_plugin_backend_tests/tests/ecma_integration.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,5 +260,7 @@ fn wasmtime() {
260260
)
261261
});
262262

263-
internal(Arc::new(WasmtimeRuntime), &PLUGIN_BYTES);
263+
tokio::runtime::Runtime::new().unwrap().block_on(async {
264+
internal(Arc::new(WasmtimeRuntime), &PLUGIN_BYTES);
265+
});
264266
}

crates/swc_plugin_backend_tests/tests/fixture/issue_6404/Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/swc_plugin_backend_tests/tests/fixture/swc_internal_plugin/Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)