perf(frontend): add build.rs asset pipeline with oxc + lightningcss

- Bundle 31 JS files → single app.{hash}.js (oxc minifier)
- Bundle 36 CSS files → single app.{hash}.css (lightningcss)
- Resolve CSS @import chains at build time
- Inline theme-init.js to eliminate render-blocking script
- Minify all individual JS/CSS/JSON assets in static-dist/
- Auto-update Service Worker cache manifest with bundle hashes
- FNV hash-based cache-busting filenames

Results: 88 → 12 requests, 640 kB → 96.5 kB transferred (-85%)

Build modes:
- Debug: copies HTML to OUT_DIR, serves original static/
- Release: generates static-dist/ with processed assets

Also:
- Update Dockerfile to include build.rs in cacher stage
- Serve static-dist/ in release Docker builds
- Remove host static/ bind mount from docker-compose
- Switch include_str!() to OUT_DIR for all HTML pages
This commit is contained in:
Diocrafts
2026-03-08 13:10:38 +01:00
parent 75979d280a
commit f409a9edd7
8 changed files with 1669 additions and 38 deletions
+8
View File
@@ -63,6 +63,14 @@ integration_tests = []
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(integration_tests)'] }
[build-dependencies]
oxc_allocator = "0.116"
oxc_parser = "0.116"
oxc_span = "0.116"
oxc_codegen = "0.116"
oxc_minifier = "0.116"
lightningcss = "1.0.0-alpha.70"
[profile.release]
lto = "fat"
codegen-units = 1