Skip to content

Commit 3de9c2a

Browse files
author
yushijie1
committed
chore(rust): 使用wasm32-wasip1代替wasm32-wasi,解决编译出错问题
1 parent 2ec47d9 commit 3de9c2a

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

.cargo/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ rustflags = ["-C", "target-feature=+crt-static"]
1818

1919
[alias]
2020
# Alias to build actual SWC plugin binary for the specified target.
21-
build-wasi = "build --target wasm32-wasi"
21+
build-wasi = "build --target wasm32-wasip1"
2222
build-wasm32 = "build --target wasm32-unknown-unknown"
2323
build-swc-plugins = "build-wasi --release -p swc_plugin_compile_mode -p swc_plugin_define_config -p swc_plugin_compile_mode_pre_process"
2424
test-swc-plugins = "test -p swc_plugin_compile_mode -p swc_plugin_define_config -p swc_plugin_compile_mode_pre_process"

.github/workflows/build-rust-wasm.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
uses: dtolnay/rust-toolchain@stable
1717
with:
1818
toolchain: stable
19-
targets: wasm32-wasi
19+
targets: wasm32-wasip1
2020
- name: Cache cargo
2121
uses: actions/cache@v3
2222
with:
@@ -33,5 +33,5 @@ jobs:
3333
uses: actions/upload-artifact@v4
3434
with:
3535
name: wasm-wasi-swc_plugins
36-
path: target/wasm32-wasi/release/*.wasm
36+
path: target/wasm32-wasip1/release/*.wasm
3737
if-no-files-found: error

.github/workflows/nodejs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ jobs:
164164
uses: dtolnay/rust-toolchain@stable
165165
with:
166166
toolchain: stable
167-
targets: wasm32-wasi
167+
targets: wasm32-wasip1
168168
- name: Cache cargo
169169
uses: actions/cache@v3
170170
with:

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ $ pnpm --filter @tarojs/binding run test
185185

186186
#### SWC 插件
187187

188-
首先在项目根目录执行 `rustup target add wasm32-wasi` 命令安装 `wasm32-wasi``target`
188+
首先在项目根目录执行 `rustup target add wasm32-wasip1` 命令安装 `wasm32-wasip1``target`
189189

190190
开发过程中可以使用 SWC 测试套件进行单元测试:
191191

@@ -207,7 +207,7 @@ $ cargo build -p [package-name]
207207

208208
Cargo workspace 会把编译产物输出到根目录的 `target` 文件夹中。进行集成测试时,需要手动把 `.wasm` 产物软链到目标文件夹,而 Github CI 在正式发布时会自动拷贝产物到正确的文件夹中。
209209

210-
如对 `@taorjs/helper` 进行集成测试时,会把 `target/wasm32-wasi/release/swc_plugin_xxx.wasm` 文件的软链到 `packages/taro-helper/swc/swc_plugin_xxx.wasm`
210+
如对 `@taorjs/helper` 进行集成测试时,会把 `target/wasm32-wasip1/release/swc_plugin_xxx.wasm` 文件的软链到 `packages/taro-helper/swc/swc_plugin_xxx.wasm`
211211

212212
####
213213

0 commit comments

Comments
 (0)