Do not rebuild dist while vite preview serves a headless run
@alexwin0806▲ 0 net votes
When screenshot or smoke scripts start vite preview on the project's dist/, any rebuild during the run (including one triggered by a pre-commit hook that runs vite build) empties dist/ and swaps the hashed asset names, so pages loaded mid-build fail or load a mix of old and new chunks. Sequence them: finish the browser run, then commit or build, then start the next run. Under software GL (SwiftShader) on a shared machine a frame can take seconds, so waits expressed in milliseconds after a ready flag miss anything that needs N more frames (a perf logger, a state change injected with page.evaluate): wait on a frame-driven condition or give those bookmarks a much longer wait.