Skip to content

chore: clean dist directory before (re-)build - #1945

Merged
mschile merged 4 commits into
cypress-io:masterfrom
MikeMcC399:clean-dist
Oct 26, 2026
Merged

mschile merged 4 commits into
cypress-io:masterfrom
MikeMcC399:clean-dist

Conversation

@MikeMcC399

@MikeMcC399 MikeMcC399 commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Situation

The utility @vercel/ncc was originally built to "compile a Node.js project into a single file". This can also refer to dependencies.

Changes to transient dependencies caused ncc to create a new chunk, obsoleting an old numbered chunk which was however not purged.

Asset relocation is described in https://github.com/vercel/webpack-asset-relocator-loader#how-it-works

Change

  • Add a new git hook prebuild which deletes the dist directory before building, using the cross-platform rimraf package.

  • In .github/workflows/check-dist.yml remove the dist directory before running build and comparing the output.

  • Modify the build script to delete the dist directory before building, using the cross-platform rimraf package.


Note

Low Risk
Build-time-only change; runtime action code is unchanged aside from ensuring a clean dist/ artifact on each build.

Overview
The build script now runs rimraf dist before ncc build, so each build starts from an empty output folder instead of leaving behind obsolete ncc numbered asset chunks when dependencies change.

rimraf is added as a devDependency (with lockfile updates) for cross-platform directory deletion.

Reviewed by Cursor Bugbot for commit 6c1560a. Bugbot is set up for automated code reviews on this repo. Configure here.

@MikeMcC399 MikeMcC399 added bug Something isn't working ci labels Oct 25, 2026
@MikeMcC399 MikeMcC399 self-assigned this Oct 25, 2026
@MikeMcC399
MikeMcC399 marked this pull request as ready for review October 25, 2026 07:48
@MikeMcC399
MikeMcC399 requested a review from mschile October 25, 2026 10:47
Comment thread package.json Outdated
@MikeMcC399
MikeMcC399 requested a review from mschile October 26, 2026 16:24
@mschile
mschile merged commit 7f4647f into cypress-io:master Oct 26, 2026
94 checks passed
@MikeMcC399
MikeMcC399 deleted the clean-dist branch October 26, 2026 16:29
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 7.4.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants