Skip to content

Commit

Permalink
internal: improve wasm file size
Browse files Browse the repository at this point in the history
  • Loading branch information
gvozdvmozgu authored and benfdking committed Sep 17, 2024
1 parent 1d18305 commit cafd016
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ jobs:
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: Install Rust
- uses: dtolnay/rust-toolchain@nightly
- name: Install rust-src
- run: rustup component add rust-src --toolchain nightly-2024-07-22-x86_64-unknown-linux-gnu
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build wasm
run: RUSTFLAGS="" pnpm run build:wasm
run: pnpm run build:wasm
- name: Build playground
run: pnpm run build
- name: Setup Pages
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
cache: "pnpm"
- run: pnpm install --frozen-lockfile
- uses: dtolnay/rust-toolchain@nightly
- run: rustup component add rust-src --toolchain nightly-2024-07-22-x86_64-unknown-linux-gnu
- run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- run: pnpm run ci
test:
Expand Down
3 changes: 2 additions & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "playground",
"type": "module",
"scripts": {
"build:wasm": "wasm-pack build ../crates/lib-wasm --release --target web --out-dir ../../playground/src/pkg",
"build:wasm": "cross-env RUSTFLAGS=\"-C opt-level=z\" wasm-pack build ../crates/lib-wasm --target web --out-dir ../../playground/src/pkg -Z build-std=panic_abort,std -Z build-std-features=panic_immediate_abort",
"build": "pnpm run build:wasm && vite build",
"dev": "vite",
"dev:wasm": "wasm-pack build ../crates/lib-wasm --dev --target web --out-dir ../../playground/src/pkg",
Expand All @@ -13,6 +13,7 @@
"@typescript-eslint/eslint-plugin": "^8.6.0",
"@typescript-eslint/parser": "^8.6.0",
"classnames": "^2.5.1",
"cross-env": "^7.0.3",
"eslint": "^9.10.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.30.0",
Expand Down
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cafd016

Please sign in to comment.