Skip to content

Commit ce99883

Browse files
committed
chore: add WASM=true for web compile
1 parent ff2019d commit ce99883

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

.github/workflows/deploy-web.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
run: make pkg
6363

6464
- name: Build website
65-
run: pnpm build
65+
run: make build-web
6666

6767
- name: Cache build
6868
uses: actions/cache/save@v3

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ build-desktop:
2121
pnpm tauri build
2222

2323
build-web: pkg
24-
pnpm build
24+
WASM=true pnpm build
2525

2626
.PHONY: license
2727
license:

src-utility/src/core/formatter/json.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ use universal_function_macro::universal_function;
2323

2424
#[derive(Debug, Clone, Serialize, Deserialize)]
2525
#[serde(rename_all = "lowercase")]
26-
#[cfg_attr(feature = "web", derive(tsify::Tsify))]
27-
#[cfg_attr(feature = "web", tsify(into_wasm_abi, from_wasm_abi))]
26+
#[cfg_attr(target_arch = "wasm32", derive(tsify::Tsify))]
27+
#[cfg_attr(target_arch = "wasm32", tsify(into_wasm_abi, from_wasm_abi))]
2828
pub enum IndentStyle {
2929
Spaces(usize),
3030
Tabs,

src-utility/src/error.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
//
1212
// See LICENSE file for details or contact [email protected]
1313

14-
#[cfg(feature = "web")]
15-
use wasm_bindgen::prelude::*;
16-
1714
#[derive(Debug, thiserror::Error)]
1815
pub enum UtilityError {
1916
#[error(transparent)]
@@ -37,9 +34,9 @@ impl serde::Serialize for UtilityError {
3734
}
3835
}
3936

40-
#[cfg(feature = "web")]
41-
impl From<UtilityError> for JsValue {
42-
fn from(err: UtilityError) -> JsValue {
43-
JsValue::from_str(&err.to_string())
37+
#[cfg(target_arch = "wasm32")]
38+
impl From<UtilityError> for wasm_bindgen::prelude::JsValue {
39+
fn from(err: UtilityError) -> wasm_bindgen::prelude::JsValue {
40+
wasm_bindgen::prelude::JsValue::from_str(&err.to_string())
4441
}
4542
}

0 commit comments

Comments
 (0)