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 dev
and prod with dynamically chosen workers. Keep filesystem cache enabled
and make compression configurable (favoring uncompressed for faster warm
builds on CPU‑bound machines). Scope the Webpack cache version to
output‑affecting dimensions for cross‑machine/CI reuse. Add
BUILD_PARALLEL to switch between parallel and sequential production
builds. Also enable dependency caching in GitHub Actions to speed up CI
runs.
Improve development behavior and outputs: keep watch mode alive on
initial compilation errors with deterministic exits via
BUILD_WATCH_ONCE, use style‑loader for faster CSS in dev, emit CSP‑safe
external source maps and copy them in dev to avoid 404s, and reduce
noisy CSS 404s by skipping only missing assets. Harden related env
parsing and consolidate logic to reduce duplication and improve
readability.
Packaging reliability: wait for the ZIP write stream to close before
proceeding to ensure archives are fully flushed on fast CI runners. No
breaking changes.
Results from a 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.
- 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