Description
Setting up a reproducible three.js dev environment currently depends on the host machine: a matching Node version, a Chromium download for e2e testing (~200 MB, per CONTRIBUTING.md), and OS-specific differences that occasionally surface in screenshot-based e2e results. New contributors pay this cost on their first PR, and CI behavior is not always easy to reproduce locally.
Solution
An optional, documented compose.yml at the repo root (works with both docker compose and podman compose) providing two services:
dev: Node LTS container running npm ci and npm start, with the repo bind-mounted and port 8080 published, so compose up dev gives the local server from a clean environment.
test: same image running npm run lint and npm run test-unit (and optionally npm run test-e2e with the browser dependencies preinstalled), matching the CI environment more closely for reproducing failures.
The containers change nothing for contributors who prefer plain npm ci; it is an additive convenience, a few dozen lines plus a short section in CONTRIBUTING.md. I am happy to submit a PR if there is interest.
Alternatives
- A devcontainer.json (VS Code / Codespaces specific; compose is editor-neutral, and a devcontainer can reuse the same compose file later).
- Documenting a plain
docker run one-liner in CONTRIBUTING.md (no orchestration of dev vs test, harder to keep in sync).
- Status quo: works, but environment drift between contributors and CI remains a support cost (e.g. e2e screenshot instability across platforms).
Additional context
The e2e README notes the effort spent making screenshots deterministic; a pinned container image removes one more source of variance (fonts, browser build, platform rendering). I am preparing GIS-related example contributions and would use this setup for all testing; other example authors would benefit the same way.
Description
Setting up a reproducible three.js dev environment currently depends on the host machine: a matching Node version, a Chromium download for e2e testing (~200 MB, per CONTRIBUTING.md), and OS-specific differences that occasionally surface in screenshot-based e2e results. New contributors pay this cost on their first PR, and CI behavior is not always easy to reproduce locally.
Solution
An optional, documented
compose.ymlat the repo root (works with bothdocker composeandpodman compose) providing two services:dev: Node LTS container runningnpm ciandnpm start, with the repo bind-mounted and port 8080 published, socompose up devgives the local server from a clean environment.test: same image runningnpm run lintandnpm run test-unit(and optionallynpm run test-e2ewith the browser dependencies preinstalled), matching the CI environment more closely for reproducing failures.The containers change nothing for contributors who prefer plain
npm ci; it is an additive convenience, a few dozen lines plus a short section in CONTRIBUTING.md. I am happy to submit a PR if there is interest.Alternatives
docker runone-liner in CONTRIBUTING.md (no orchestration of dev vs test, harder to keep in sync).Additional context
The e2e README notes the effort spent making screenshots deterministic; a pinned container image removes one more source of variance (fonts, browser build, platform rendering). I am preparing GIS-related example contributions and would use this setup for all testing; other example authors would benefit the same way.