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
Account for ConfigItem being generated by another copy of Babel #11734
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/32245/ |
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.
not sure how else we want to handle this issue, also wonder other cases we are using instanceof
and might have this problem?
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 a00bf9e:
|
Another suggestion, rather than changing all the instanceof checks, might be to throw or warn when this behavior is detected: import core from '@babel/core'; // could be a separate copy of Babel (determined by npm)
export function custom() {
return {
config() {
core.createConfigItem(...)
// "Error: detected ConfigItem instances from a different version of Babel"
}
}
} |
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
515cd75
to
93ca9c8
Compare
This fixes
ConfigItem
unboxing whencore.createConfigItem()
is used to generate a ConfigItem that is then passed to a different copy of Babel. This is common in cases where npm fails to dedupe modules, or when differing versions of Babel are in-use.