-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Return a list of files that were read from loadPartialConfig #11907
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
Return a list of files that were read from loadPartialConfig #11907
Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/26973/ |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 0b92084:
|
|
Anything I can do to move this forward? 😄 |
JLHwung
left a comment
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.
Look good to me. If we get enough approvals, will need to update https://babeljs.io/docs/en/babel-core#loadpartialconfig
|
I'm happy to send a PR for that! |
|
I'm merging this to |
|
@devongovett @JLHwung @existentialism @kaicataldo When I asked for However, while implementing it I realized that it's not possible because I found another way of detecting ignored vs unsupported: if For this reason, I propose to change back the design of this PR to |
|
@nicolo-ribaudo I don't have strong preference here. But I believe
should be documented somewhere. If |
|
Sure, I'll document it alongside with the |
* Add docs for loadPartialConfig file handling changes babel/babel#11907 * Update core.md
This adds a
fileslist to the return value ofbabelCore.loadPartialConfigwhich lists all files that were read in the process of loading the config. Some of these are currently returned in thebabelrc,babelignore, andconfigFilefields, but other files such as those that were extended from another config are not returned, making it difficult for other tools that consume babel (e.g. Parcel, webpack) to properly watch these extended configs and invalidate caches. Thefileskey should solve this as it includes all files that influenced the config, not just the top-level ones.In addition, I've added a
showIgnoredFilesoption toloadPartialConfigwhich always returns aPartialConfigresult even when the file is ignored, rather than returningnull. This allows tools to properly invalidate caches when whatever config file that marked the compiled file as ignored changes. AnisIgnoredboolean is returned as part of thePartialConfigresult to indicate that the file is ignored. Given that changing thenullresult to return a value would be a breaking change, this is behind an option. Open to better name suggestions though! 😉This is really important for us in Parcel so that we can get proper caching working with Babel. At the moment there's really no good way to do that without support from Babel itself, or reinventing all of its config loading. This should also help other tools like babel-loader - found a todo comment for it. 😄
Totally open to alternative suggestions. Really made this to get the conversation started.