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 committed Sep 17, 2024
1 parent abc267b commit eea45e6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 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
with:
components: rust-src
- 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
4 changes: 3 additions & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ jobs:
node-version-file: ".nvmrc"
cache: "pnpm"
- run: pnpm install --frozen-lockfile
- uses: dtolnay/rust-toolchain@nightly
- uses: dtolnay/rust-toolchain@nightly-2024-07-22-x86_64-unknown-linux-gnu
with:
components: rust-src
- 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 eea45e6

Please sign in to comment.