Previewing a release
The dev loop is not what ships: NODE_ENV is "development" and nothing is hashed. esdev preview serves the release output, which is where failures the dev loop is blind to show up — a package that hands over a different module under production, or a <link> pointing at a name hashing changed.
esdev build esdev preview # → http://127.0.0.1:4173 esdev preview --dir=dist --port=5000 esdev preview --config=deploy/esdev.json # the site another project file describes
Preview serves existing output; it does not build. It serves the output the way a static host does: a missing path gets a 404 status, with the output's top-level 404.html as the page when it has one. Responses support ETag and Last-Modified revalidation (304) and HTTP range requests (206, or 416 when a range cannot be satisfied).
Single-page apps
A client-side router needs every route to load index.html. Pass --spa so that a missing path with no file extension gets index.html with a 200:
esdev preview --spa
Missing files with an extension, such as /app.js, still get a 404.
Server bundles
A server bundle has no static output to preview. Run it under esrun, as it will run in production.
The project's dev.server.proxy applies here too, so a page that calls /api reaches the same API server it does in the dev loop.
Any static folder, no packages
--dir serves whatever folder you point it at — no project, no esdev.json, no npx serve or python3 -m http.server. The folder needs an index.html at its root; everything else is served as-is, with the same 404 handling, --spa, validators, and ranges as above.
esdev preview --dir=./public # → http://127.0.0.1:4173 esdev preview --dir=./dist --port=5000
Handy for a mock API's docs folder, a downloaded theme, or the dist/ of a tool that is not esdev build — anything with an entry document. Loopback only, like every endpoint esdev opens; Ctrl-C stops it.
For the rebuild-and-reload workflow, return to The dev loop.