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鈥檒l 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
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? 馃槃 |
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
files
list to the return value ofbabelCore.loadPartialConfig
which lists all files that were read in the process of loading the config. Some of these are currently returned in thebabelrc
,babelignore
, andconfigFile
fields, 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. Thefiles
key should solve this as it includes all files that influenced the config, not just the top-level ones.In addition, I've added a
showIgnoredFiles
option toloadPartialConfig
which always returns aPartialConfig
result 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. AnisIgnored
boolean is returned as part of thePartialConfig
result to indicate that the file is ignored. Given that changing thenull
result 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.