fix(build): correct asset path resolution for local release build and remove duplicated resources

This commit is contained in:
xfy 2026-06-26 18:35:48 +08:00
parent 225c477f8c
commit 18db852f30
2 changed files with 14 additions and 5 deletions

View File

@ -12,7 +12,3 @@ watch_path = ["src", "Cargo.toml"]
[web.resource]
style = ["/style.css", "/highlight.css", "/tiptap/editor.css", "/lightbox/lightbox.css", "/yggdrasil-core/yggdrasil-core.css"]
script = ["/tiptap/editor.js", "/lightbox/lightbox.js", "/yggdrasil-core/yggdrasil-core.js"]
[web.resource.dev]
style = ["/style.css", "/highlight.css", "/tiptap/editor.css", "/lightbox/lightbox.css", "/yggdrasil-core/yggdrasil-core.css"]
script = ["/tiptap/editor.js", "/lightbox/lightbox.js", "/yggdrasil-core/yggdrasil-core.js"]

View File

@ -1,4 +1,4 @@
.PHONY: dev build build-linux css css-watch clean build-editor build-editor-incremental build-lightbox build-lightbox-incremental build-core build-core-incremental highlight-css test doc doc-open
.PHONY: dev build build-linux css css-watch clean build-editor build-editor-incremental build-lightbox build-lightbox-incremental build-core build-core-incremental highlight-css test doc doc-open start
build:
@$(MAKE) build-editor
@ -8,6 +8,11 @@ build:
@tailwindcss -i input.css -o public/style.css --minify
@$(MAKE) doc
@dx build --release --debug-symbols=false
@echo ""
@echo "Build complete! To run the release version locally, use:"
@echo " make start"
@echo "Or run manually with:"
@echo " DIOXUS_ASSET_DIR=target/dx/yggdrasil/release/web/public ./target/dx/yggdrasil/release/web/server"
build-linux:
@$(MAKE) build-editor
@ -17,6 +22,10 @@ build-linux:
@tailwindcss -i input.css -o public/style.css --minify
@dx build @client --release --debug-symbols=false --wasm-js-cfg false
@dx build @server --release --debug-symbols=false --target x86_64-unknown-linux-musl --wasm-js-cfg false --features server
@echo ""
@echo "Linux build complete! The server binary is at target/dx/yggdrasil/release/web/server"
@echo "Remember to deploy it alongside the target/dx/yggdrasil/release/web/public directory."
@echo "When running the server, ensure DIOXUS_ASSET_DIR is set or the public directory is in CWD."
highlight-css:
@cargo run --bin generate_highlight_css
@ -59,6 +68,10 @@ dev: build-editor-incremental build-lightbox-incremental build-core-incremental
trap 'kill $$TAILWIND_PID 2>/dev/null; exit' INT TERM EXIT; \
SSR_CACHE_SECS=0 dx serve --addr 0.0.0.0
start:
@echo "Starting local release build..."
@DIOXUS_ASSET_DIR=target/dx/yggdrasil/release/web/public ./target/dx/yggdrasil/release/web/server
css:
@tailwindcss -i input.css -o public/style.css