fix: getRootDir behaviour for single directory causing wrong project root #7251
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.
Linked issue: #7145
↪️ Pull Request
The getProjectRoot command was returning a wrong root when passed in a folder value. This caused the wrong project root to be determined when running in watch mode. In some cases this caused the entire filesystem to be watched.
The reason this is a draft is that this change breaks about ~100 integration tests, I'm happy to look into fixing those as well, but I'd like to first get feedback and confirm that my change aligns with the intended behaviour of the
getProjectRoot
function.I tested this on a repo that was not working due to this bug, and now the .proxyrc.js file was loaded correctly and the site could be loaded. In fact some extra config files (.babelrc) also got loaded thanks to this.
Even if this is the intended change it's probably a huge breaking change, so please advise on how should I proceed.
Thank you for the amazing work on this project, adding a new test and making this fix was a breeze.
💻 Examples
Loading .proxyrc.js from project didn't work and explicitly setting the path for it wasn't possible.
🚨 Test instructions
✔️ PR Todo