Skip to content

Commit 02cdbf5

Browse files
committed
Compile wasm
1 parent 199c67c commit 02cdbf5

File tree

5 files changed

+101
-4
lines changed

5 files changed

+101
-4
lines changed

.github/workflows/wasm.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
on:
2+
push:
3+
name: "wasm"
4+
jobs:
5+
build:
6+
name: Building WASM
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
with:
11+
submodules: true
12+
13+
- name: Install Rust Nightly
14+
uses: dtolnay/rust-toolchain@stable
15+
with:
16+
toolchain: nightly-2024-05-18
17+
components: rust-src
18+
19+
- name: Build binaries
20+
run: |
21+
rustup target add wasm32-unknown-unknown
22+
cargo build -p powersync_loadable --target wasm32-unknown-unknown --profile wasm
23+
mv "target/wasm32-unknown-unknown/wasm/powersync.wasm" "powersync.wasm"

Cargo.lock

+74-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ inherits = "release"
2222
# Enabling LTO in WASM build gives:
2323
# warning: Linking globals named '__rust_alloc_error_handler': symbol multiply defined!
2424
# error: failed to load bitcode of module "sgnxivc9sns8d6t":
25-
lto = false
25+
lto = "thin"
2626

2727
[workspace.package]
2828
version = "0.1.7"

crates/core/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ serde = { version = "1.0", default-features = false, features = ["alloc", "deriv
2424
version = "1.4.1"
2525
default-features = false
2626
features = [
27-
"v4"
27+
"v4",
28+
"js",
2829
]
2930

3031

crates/loadable/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use sqlite_nostd::SQLite3Allocator;
2020
static ALLOCATOR: SQLite3Allocator = SQLite3Allocator {};
2121

2222
// Custom Panic handler for WASM and other no_std builds
23+
#[cfg(not(target_family = "wasm"))]
2324
#[cfg(not(test))]
2425
#[panic_handler]
2526
fn panic(_info: &core::panic::PanicInfo) -> ! {

0 commit comments

Comments
 (0)