Repository navigation
fix(clean): only list the output directory when cleaning it - #1092
Open
lifeiscontent wants to merge 3 commits into
Open
lifeiscontent wants to merge 3 commits into
lifeiscontent wants to merge 3 commits into
Conversation
The default clean pattern is the absolute outDir path, so the glob had to read the parent directory to match it. Tools that fingerprint directory reads then saw every sibling of the output directory as a build input. Glob the contents of outDir directly when a clean entry is exactly the output directory, and keep the combined glob for other and negated patterns.
✅ Deploy Preview for tsdown-main ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
tsdown
create-tsdown
@tsdown/css
@tsdown/exe
tsdown-migrate
commit: |
On Windows the glob returns forward slashes and outDir has backslashes, so the output directory itself was never skipped and got removed, along with anything a negated pattern meant to keep.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some build tools fingerprint every file and directory a process reads, including directory listings, to decide when a build needs to rerun. With the default
clean: true, tsdown globs the absoluteoutDirpath from the project root, so the glob reads the root directory to find it. Every sibling ofdistthen looks like a build input, and adding or changing an unrelated file next to it invalidates the build.When a clean entry is a literal path to
outDir, this globs the contents ofoutDirdirectly. The same files are removed. Other patterns and configs with negated patterns still use the existing glob fromcwd. The new test checks which directories are read for a default, nested and missingoutDir, and that custom and negated patterns still work.The second commit fixes a Windows bug the new negation test exposed: glob results use forward slashes but
outDirhas backslashes, so the output directory itself was removed, including files a negated pattern should keep.