fix(register): skip hook for ignored files#17928
Conversation
| return await store({ code, map }); | ||
| } | ||
|
|
||
| async function isFileIgnored(filename: string) { |
There was a problem hiding this comment.
This helper can potentially be reused by the babel-cli: See #17878
Do you think we should make it an API of @babel/core?
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/61288 |
|
commit: |
|
https://babeljs.io/docs/babel-register#specifying-options |
Thanks, as is said in the docs, |
I looked into this issue a bit, if we want to completely remove the If performance is your concern, I think what we can do is to disable |
|
It appears that we don't support patterns in the documentation, but only regular expressions and functions. |
I believe this is a doc issue. In somewhere we mentioned that it supports regex / glob, elsewhere regex / function. I have updated the register docs to reflect on the current implementation: babel/website#3190 |
In this PR we skip the babel-register hook for ignored files in programmatic options. Previously the hook was still registered for ignored files and therefore an ignored
.tsfile may throw syntax error because the original JS loader, where the builtin TS type stripping happens, was skipped aspirateshas no knowledge that Babel does not handle this ignored file.