-
-
Notifications
You must be signed in to change notification settings - Fork 759
fix: NativeWatchFileSystem should handle inputFileSystem when files change #11164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the NativeWatchFileSystem to properly handle the inputFileSystem when files change during watch mode. The fix ensures that the file system cache is properly purged when files are modified or removed, preventing stale cached data from being used.
Key changes:
- Modified NativeWatchFileSystem constructor to accept and store an inputFileSystem parameter
- Added cache purging logic to clear cached file data when files change or are removed
- Fixed a potential infinite loop in the Rust watcher executor by changing return to continue
- Added comprehensive test coverage for the native watcher functionality
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
packages/rspack/src/node/NodeEnvironmentPlugin.ts | Updated to pass inputFileSystem parameter to NativeWatchFileSystem constructor |
packages/rspack/src/NativeWatchFileSystem.ts | Added constructor parameter and cache purging logic for changed/removed files |
crates/rspack_fs/src/watcher/executor.rs | Fixed potential infinite loop by changing return to continue in empty files condition |
tests/webpack-test/jest.config.js | Enabled new native watcher test cases in Jest configuration |
tests/webpack-test/NativeWatcherTestCases.longtest.js | Added new test file for native watcher functionality |
✅ Deploy Preview for rspack ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📦 Binary Size-limit
❌ Size increased by 128bytes from 49.00MB to 49.00MB (⬆️0.00%) |
CodSpeed Performance ReportMerging #11164 will not alter performanceComparing 🎉 Hooray!
|
…hange and add test cases
Co-authored-by: Copilot <[email protected]>
…mprove error handling in DiskWatcher
72135a8
to
f91e770
Compare
…g aggregated changes on timeout
Summary
What This PR Does
This PR fixes a critical bug in Rspack's NativeWatchFileSystem where it wasn't properly handling the inputFileSystem cache invalidation when files change during watch mode, leading to stale cached file contents and incorrect build behavior.
Key Issues Fixed
Problem: When files changed during watch mode, the inputFileSystem cache wasn't being purged, causing the compiler to use outdated file contents
Solution: Added proper cache purging logic that calls fs.purge?.(item) for both changed and removed files
Problem: In the Rust watcher executor, when the file list was empty, the function would return instead of continue, causing the watch loop to exit prematurely
Solution: Changed return to continue to keep the watcher loop running even when no files are pending
Related links
Checklist