You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor build pipeline for performance and dev output reliability
Replace JS/CSS minifiers with esbuild to significantly reduce build
times while preserving outputs.
Enable thread-loader by default in both dev and prod with workers
chosen dynamically. Keep filesystem cache enabled and make cache
compression configurable (favoring uncompressed for faster warm builds
on CPU‑bound machines). Add BUILD_PARALLEL to switch between parallel
and sequential production variant builds.
Improve development outputs: ensure watch‑once builds exit cleanly,
use style-loader for faster CSS in dev, keep CSP‑safe external source
maps and copy them in dev to avoid 404s, and suppress noisy CSS 404s
by skipping only missing assets.
Maintainability: consolidate dev CSS placeholder handling and
centralize cache‑compression option parsing to reduce duplication and
improve readability. Align the Sass fallback error message with the
repository string style. No behavioral changes.
Additionally, enable dependency caching in GitHub Actions to speed up
CI runs.
Results on this DO VPS (2 cores, ~4 GiB RAM):
- Production first run (cold): ~44s (baseline ~105s)
- Production second run (warm): ~19s (baseline ~39s)
- Development first run: ~31s; second run: ~29s
Times vary by environment; numbers above are for this machine.
- Default: `0` (no compression) for faster warm builds on CPU‑bound SSD machines
29
+
- Options: `0|false|none`, `gzip` (or `brotli` if explicitly desired)
30
+
- Affects only `.cache/webpack` size/speed; does not change final artifacts
31
+
- BUILD_WATCH_ONCE (dev): When set, `npm run dev` runs a single build and exits (useful for timing)
32
+
- BUILD_POOL_TIMEOUT: Override thread-loader production pool timeout (ms)
33
+
- Default: `2000`. Increase if workers recycle too aggressively on slow machines/CI
34
+
- Source maps (dev): Dev builds emit external `.map` files next to JS bundles for CSP‑safe debugging; production builds disable source maps
35
+
- Symlinks: Webpack uses `resolve.symlinks: false` to improve performance and ensure consistent module identity; if you rely on `npm link`/pnpm workspaces, temporarily enable symlink resolution while developing linked packages
36
+
37
+
Performance defaults: esbuild handles JS/CSS minification. In development, CSS is injected via style-loader; in production, CSS is extracted via MiniCssExtractPlugin. Thread-loader is enabled by default in both dev and prod.
38
+
20
39
### Build Output Structure
21
40
22
41
Production build creates multiple variants in `build/` directory:
0 commit comments