Files
Nicolò Boschi 7a0c8801bb docs(dev): light start-docs that compiles pages on first visit (~1 GB instead of ~3.5 GB) (#6159)
start-docs.sh now sets DOCS_LIGHT=true unless --full is passed. The
dev-light plugin then:
- turns on rspack lazy compilation for dynamic imports, and strips the
  require.resolveWeak() entries from the generated route registry, which
  otherwise force every page to be built at startup anyway
- turns off source maps
- gives each page its own CSS file, so a page compiled on first visit is
  styled (the single shared styles.css was already loaded)
and the rspack persistent cache is off in this mode, since restoring it
loads every cached page back into memory.

Production builds are unchanged.
2026-10-28 16:35:46 +01:00

33 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Start the Hindsight documentation server
# This script starts a local Docusaurus development server for the documentation
set -e
# Get the project root directory
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
cd "$PROJECT_ROOT" || exit 1
# Always show the "current" (Next / unreleased) docs version in local dev.
# docusaurus.config.ts reads this flag to decide which versions to include.
# Do NOT rely on NODE_ENV for this — it's unreliable across hot-reload paths.
export INCLUDE_CURRENT_VERSION=true
# Light mode (default): pages compile only when first opened and there are no
# source maps (plugins/dev-light) — about 1 GB instead of ~3.6 GB.
# Pass --full to compile every page up front, as `docusaurus build` does.
if [ "$1" = "--full" ]; then
shift
else
export DOCS_LIGHT=true
fi
echo "Starting documentation server..."
echo ""
echo "Starting Docusaurus development server..."
echo "Documentation will be available at: http://localhost:3000"
echo "INCLUDE_CURRENT_VERSION=true (Next/unreleased docs visible)"
echo ""
npm run start -w hindsight-docs -- --no-open