Skip to content

Commit

Permalink
Switch to using hydrate lib
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanRJohnston committed Aug 29, 2024
1 parent b159771 commit 19f05a6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ shared = { path = "./shared", version = "0.1.0" }

# Enable a small amount of optimization in debug mode
[profile.dev]
opt-level = 's'
strip = true
opt-level = 1
# strip = true

# Enable high optimizations for dependencies (incl. Bevy), but not for our code:
[profile.dev.package."*"]
Expand All @@ -17,4 +17,4 @@ opt-level = 3
[profile.release]
lto = true
opt-level = 's'
strip = true
# strip = true
2 changes: 1 addition & 1 deletion app/src/bin/client.rs → app/src/hydrate.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::io;

use app::app;
use crate::app;
use leptos::{leptos_dom::logging::console_log, mount_to_body};
use wasm_bindgen::prelude::wasm_bindgen;

Expand Down
2 changes: 2 additions & 0 deletions app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ pub mod adapters;
pub mod extractors;
#[cfg(feature = "ssr")]
pub mod handlers;
#[cfg(feature = "hydrate")]
pub mod hydrate;
#[cfg(feature = "ssr")]
pub mod middleware;
#[cfg(feature = "ssr")]
Expand Down
15 changes: 8 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@
cp -r assets/* site/
cp -r game/assets site/assets
cargo build --target wasm32-unknown-unknown --no-default-features --release -p app --lib --features app/hydrate,app/wasm
${pkgs.wasm-bindgen-cli}/bin/wasm-bindgen ./target/wasm32-unknown-unknown/release/app.wasm --no-typescript --remove-name-section --remove-producers-section --out-name index --target web --out-dir ./site/pkg
cargo build --target wasm32-unknown-unknown --no-default-features --release -p app --bin worker --features app/ssr,app/wasm
cargo build --target wasm32-unknown-unknown --no-default-features --release -p app --bin client --features app/hydrate,app/wasm
cargo build --target wasm32-unknown-unknown --no-default-features --release -p game --bin game --features game/wasm
${pkgs.wasm-bindgen-cli}/bin/wasm-bindgen ./target/wasm32-unknown-unknown/release/worker.wasm --no-typescript --remove-name-section --remove-producers-section --out-name index --target bundler --out-dir ./site
${pkgs.wasm-bindgen-cli}/bin/wasm-bindgen ./target/wasm32-unknown-unknown/release/worker.wasm --no-typescript --out-name index --target bundler --out-dir ./site
${pkgs.wasm-bindgen-cli}/bin/wasm-bindgen ./target/wasm32-unknown-unknown/release/client.wasm --no-typescript --out-name index --target web --out-dir ./site/pkg
${pkgs.wasm-bindgen-cli}/bin/wasm-bindgen ./target/wasm32-unknown-unknown/release/game.wasm --no-typescript --out-name game --target web --out-dir ./site/pkg
cargo build --target wasm32-unknown-unknown --no-default-features --release -p game --bin game --features game/wasm
${pkgs.wasm-bindgen-cli}/bin/wasm-bindgen ./target/wasm32-unknown-unknown/release/game.wasm --no-typescript --remove-name-section --remove-producers-section --out-name game --target web --out-dir ./site/pkg
'';

dev-clean = pkgs.writeShellScriptBin "dev-clean" ''
Expand All @@ -75,9 +76,9 @@
set -o errexit
set -o pipefail
CLIENT_TARGET="./target/wasm32-unknown-unknown/debug/client.wasm"
CLIENT_TARGET="./target/wasm32-unknown-unknown/debug/app.wasm"
cargo build --target wasm32-unknown-unknown --no-default-features -p app --bin client --features app/hydrate,app/wasm
cargo build --target wasm32-unknown-unknown --no-default-features -p app --lib --features app/hydrate,app/wasm
${pkgs.wasm-bindgen-cli}/bin/wasm-bindgen $CLIENT_TARGET --no-typescript --out-name index --target web --out-dir ./site/pkg
echo "############### FINISHED BUILDING CLIENT ###############"
Expand Down

0 comments on commit 19f05a6

Please sign in to comment.