-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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 error: "Error: We don't know what to do with this node type. We were previously a Statement but we can't fit in here?" #20038
Comments
(I’m a bit perplexed by this “Old Version” tag the bot applies. I filed this mere hours after 0.56 was released, which doesn’t sound very old to me…) |
The preset doesn't have the decorators plugin though: |
I am experiencing this issue, so I investigated it a bit. I narrowed it down to This appears to be a Babel 7 issue. I've figured out a minimal repro, and it's quite weird. export class Bug {
// To get the same error we're seeing, this static declaration is necessary.
// However, the error we're seeing is likely hiding another one, because if
// this declaration is removed, another error occurs.
static blah = {};
constructor(props) {
this.test(props);
}
test = (props) => {
// This is the line that is actually causing the real error
const test = props.test;
}
}
export default Bug; The original error that appears when the static declaration is left alone is:
When the static declaration is removed, the real error is revealed:
|
I have the same issue and i'm also using react-native-modal, I'm trying to update right now .. |
@mmazzarolo Right now the only thing I found is not a fix but a workaround... I transpiled your code to ES5 using repl and replaced it... but it works 😭 |
The easiest workaround for now is simply to remove the The bug is with Babel, not |
I'm trying your fix right now @Ashoat EDIT: it's working for me. @mmazzarolo EDIT 2: I'll create a PR. |
I'd like to report the bug to the Babel team, but I'm not sure how to reproduce it outside a React Native environment. I tried to create a minimal repro using However, I did get a minimal React Native repro working. Does anybody who knows more about how Metro uses Babel know what I'm missing in the pure-Babel repro? |
I'm still experiencing this error after bumping version of |
I just opened the file in the stacktrace and added |
Thanks @Ashoat , I've found it. Another culprit is EDIT: new version (6.0.0) of |
Yep, just released a new version of that one as well! |
@mmazzarolo thank you! |
@Ashoat and @mmazzarolo thank you very much for treading this path ... I followed in your footsteps with only the effort of googling the right search. Successfully running RN 0.56 with react-native-modal 6.2.0 and babel 7.
|
Since I haven't been able to repro the issue with raw Babel using Going to close this issue seems we've found a short-term workaround for the issue, and the Metro issue tracks the long-term issue. |
Environment
Description
With Webpack, everything works fine. With
react-native
, it fails, using the same Babel setup except that I usebabel-preset-react-native
instead of@babel/preset-env
. Other Babel config:Internal preset
.babelrc
Error:
Unfortunately I do not have a demo and can’t share the (proprietary) source, but any suggestions on how to go about debugging this would be welcome.
It seems likely that this is related to the decorators plugin, but the relevant stuff seems to work fine in Webpack but fail with RN, in spite of using the same config for decorators and class-props plugins, the same version of all the
@babel/
packages (pinned to the same7.0.0-beta.47
asbabel-preset-react-native
), &c.The text was updated successfully, but these errors were encountered: