fix(wasm): gate wasm32-only imports behind cfg, add binaryen wasm-opt pass
Build and Deploy / build-and-push (push) Failing after 1m12s
Build and Deploy / build-and-push (push) Failing after 1m12s
- Gate `Startup` and `user_theme_dir` imports in theme/registry.rs behind `#[cfg(not(target_arch = "wasm32"))]` — they are only used in the non-wasm code path, eliminating two unused-import warnings in the WASM release build. - Rebuild canvas_bg.wasm and solitaire_wasm_bg.wasm with wasm-opt -Oz (binaryen v129); canvas_bg.wasm drops from 57 MB → 30 MB. - Add solitaire_web/Cargo.toml stub to server Dockerfile so `cargo fetch --locked` resolves all workspace members. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -22,11 +22,15 @@
|
||||
use std::path::Path;
|
||||
|
||||
use bevy::log::warn;
|
||||
use bevy::prelude::{App, Plugin, Resource, Startup};
|
||||
use bevy::prelude::{App, Plugin, Resource};
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use bevy::prelude::Startup;
|
||||
use serde::Deserialize;
|
||||
|
||||
use super::ThemeMeta;
|
||||
use crate::assets::{DARK_THEME_MANIFEST_URL, user_theme_dir};
|
||||
use crate::assets::DARK_THEME_MANIFEST_URL;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use crate::assets::user_theme_dir;
|
||||
|
||||
/// One entry in the [`ThemeRegistry`] — the data the picker UI needs
|
||||
/// to render a row and load the theme on selection.
|
||||
|
||||
@@ -21,11 +21,12 @@ COPY solitaire_server/Cargo.toml ./solitaire_server/Cargo.toml
|
||||
COPY solitaire_app/Cargo.toml ./solitaire_app/Cargo.toml
|
||||
COPY solitaire_assetgen/Cargo.toml ./solitaire_assetgen/Cargo.toml
|
||||
COPY solitaire_wasm/Cargo.toml ./solitaire_wasm/Cargo.toml
|
||||
COPY solitaire_web/Cargo.toml ./solitaire_web/Cargo.toml
|
||||
|
||||
# Stub every workspace crate so `cargo fetch --locked` resolves the full
|
||||
# dependency graph without requiring source files beyond Cargo.toml.
|
||||
RUN for crate in solitaire_core solitaire_sync solitaire_data solitaire_engine \
|
||||
solitaire_server solitaire_app solitaire_assetgen solitaire_wasm; do \
|
||||
solitaire_server solitaire_app solitaire_assetgen solitaire_wasm solitaire_web; do \
|
||||
mkdir -p $crate/src && echo "pub fn _stub() {}" > $crate/src/lib.rs; \
|
||||
done && \
|
||||
echo "fn main() {}" > solitaire_server/src/main.rs && \
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user