-
Notifications
You must be signed in to change notification settings - Fork 29
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
Prevent unnecessary FS calls #16
Comments
Thanks for opening this issue @gaearon, this definitely seems like it could cause performance issues in big projects. I'll look into it. |
Note that after some discussion, we might not include the plugin after all. I'm worried it will too often be unactionable especially for tiny deps where this doesn't matter (e.g. |
That's a good point in the context of CRA, I think it all depends on the type/magnitude of the project and what the developers deem important in the context of that project. Maybe we can make the plugin configurable to make it more appropriate for use with CRA, such as setting a minimum size for deps before warning? |
That would make sense, but it's not obvious how the plugin could measure that. |
It seems like the plugin does a bunch of FS calls for every single file. This can cause build performance issues in large projects.
Could you consider caching some results? For example if I put a lot before
fs.existsSync
check infind-root
, I see output like this for a tiny project that just importsreact
andreact-dom
:There might be some opportunities to improve here.
For example when we learn the root for
packages/react-scripts/template/src/App.css
by traversing upwards, we can memoize that it's also the root forpackages/react-scripts/template/src/
andpackages/react-scripts/template/
.Then next time we traverse we can short-circuit instead of checking it again.
I would suggest taking a large project (>1000 files) and profiling the build time with and without this plugin. If there is a noticeable difference it's worth trying to cache more things.
The text was updated successfully, but these errors were encountered: