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
BABEL_TRANSFORM_ERROR - babel traverse context - cannot read property "removeBinding" of null #12383
Comments
Hey @salvoravida! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly. If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite." |
The goal of #12331 was to fix problems really similar to the one reported in your stack trace. Plugins can optimize AST traversal by passing a The problem (fixed by #12331) was that sometimes an old value of The "technically a breaking change" introduced by that PR is that now the I'm thus surprised by this error, but yeah we should fix the regression. However, we'll need your help to do it. When opening a new issue in this repository, GitHub gives you a form similar to this one: As you can see, there are some predefined sections:
Without the missing information (marked with ❌), we cannot fix this issue.
I understand that depending on your employer's policy it might be impossible for you to just give us the full contents of PS. (I'm replying here to #12331 (comment))
I strongly recommend using a lockfile |
I think To reproduce:
|
This comment has been minimized.
This comment has been minimized.
We are also having issues due to this change and our CI is failing since then. As far as I understand, but maybe it is wrong, there are conflicts with the babel minify presets that we solved by using the I understand that it could take a while to check and fix it. |
A workaround that mostly worked for me was to disable the |
Thanks @ehoogeveen for the example and workaround! I will investigate a fix today, in the meantime you can add |
I trimmed down the reproduction example to just two plugins: EDIT: In case someone is interested, this is the minimal amount of code to trigger the bug: function compareVersions() {
var precision = 0;
var chunks = precision;
while (precision) {}
} and the problem uncovered by #12331 is that they try to do two different things with the function compareVersions() {
var precision = 0,
chunks = precision;
while (precision) {}
} while function compareVersions() {
var precision = 0;
for (var chunks = precision; precision;);
} Somehow one of them is getting a stale AST node causing problems (but this is not a bug with |
Having our CI build failing as well with the very same issue, without explicitly using any of the packages you mentioned here ... I can hardly tell which workaround could be used in my case, here are the babel packages we use
And a snippet from our failing build -
|
I'll open a PR today, hoping for a patch release today. @w3nda You can try #12383 (comment), which is a generic workaround and not specific to |
I managed to reproduce the bug even reverting #12331: that PR made this bug more common, but didn't cause it. |
Can the people who see this bug in their project try to replace the function getSibling(key) {
return _index.default.get({
parentPath: this.parentPath,
parent: this.parent,
container: this.container,
listKey: this.listKey,
key: key
- });
+ }).setContext(this.context);
} |
With that change applied, the removeBinding errors are gone. However I do still get the following error when minifying
I also got that error without the fix when disabling minify-simplify. I'm not sure the stack is entirely consistent; it might be hitting the limit at different points (or staying just beneath it in some cases) - without the fix but with minify-simplify disabled, I got the error while minifying
Tested on Windows 10 x64. |
I confirm that patching |
@ehoogeveen |
I was able to work around the stack overflow by calling the babel cli using |
Thanks, it worked just fine. I also updated my package-lock.json with these values and changed my CI system to use the command "npm ci" instead of "npm install", to always pull this version until i manually update (thanks @nicolo-ribaudo for the tip!) |
I'm keeping this open until it's released, in case someone else has the same problem. |
@nicolo-ribaudo any idea on when this is getting released? |
Released as |
Bug Report
EDIT by @nicolo-ribaudo
You can workaround this bug by making sure that
@babel/core
uses an older@babel/traverse
version.If you are using
yarn
you can specify"@babel/traverse": "7.12.0"
inresolutions
, otherwise you can try downgrading it as described by #12383 (comment).#12331 after this pr
"This is technically a breaking change (we are changing the default value of a parameter in the public API), but I couldn't find anyone online using that parameter and I'm not sure why anyway would not wont it to use the correct context."
is there anyone that do code review, here @babel ?
What do you think about semver?
The text was updated successfully, but these errors were encountered: