From 69cfc0fe07e0d1b1010029236a1aaab55860ba1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=90=91=E5=A4=9C?= Date: Tue, 25 Feb 2025 17:08:51 +0800 Subject: [PATCH] docs(rust-plugins): update readme --- .github/workflows/build.yaml | 4 ++-- rust-plugins/wasm/README.md | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e28accbd..7eb601ef 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -65,7 +65,7 @@ jobs: target: aarch64-unknown-linux-gnu zig: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 2 # - run: | @@ -76,7 +76,7 @@ jobs: with: shared-key: rust-build-${{ matrix.settings.abi }} - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 18 - name: Install Dependencies diff --git a/rust-plugins/wasm/README.md b/rust-plugins/wasm/README.md index 146b27af..dd7825c4 100644 --- a/rust-plugins/wasm/README.md +++ b/rust-plugins/wasm/README.md @@ -1,6 +1,6 @@ # @farmfe/plugin-wasm -A farm plugin for importing Wasm modules. +A Farm plugin for seamless WebAssembly integration and support `wasm-pack` generated modules. ## Installation @@ -48,4 +48,9 @@ init({ }); ``` -In production builds, `.wasm` files smaller than the `assetInlineLimit` will be inlined as base64 strings. Otherwise, they will be treated as static assets and fetched on demand. +You can also directly import WASM packages like ESM modules without using the `?init` query: + +```ts +import { someFunc } from 'wasm-project'; +someFunc(); // Run this wasm function +```