-
Notifications
You must be signed in to change notification settings - Fork 10.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
Optional Chaining Not Working in gatsby-node.js #23802
Comments
@graysonhicks Optional chaining works in files that in some way are handled by webpack - that includes all source files as well as We will be adding some kind of support for running babel on those automatically (as part of efforts to completely support typescript out of the box), so this would solve both problem you described as well as add typescript support, but it's not yet implemented. |
@pieh Yea that's what I was thinking. Will be nice to see this added. Thanks. |
Thank you for opening this! Since the original issue was answered I'll close this one. You can follow #18983 to see how our TS progress goes. Implicitly out of this you'll then also be able to use it - for now that's not the case. |
Description
I noticed optional chaining was added out of the box, which is great. However, I noticed that optional chaining works in source files, but not in the root level gatsby-node.js file.
Steps to reproduce
Go to this sandbox and look at the terminal and the gatsby-node.js file: https://codesandbox.io/s/fervent-lehmann-3hvlb?file=/gatsby-node.js
Expected result
Should be able to use optional chaining throughout the project including plugins, not just inside components, pages and templates. Should not need a library like
dlv
just for these files, the babel preset should cover the entire project.Actual result
See this error:
Environment
Note: this is info from the CodeSandbox terminal:
The text was updated successfully, but these errors were encountered: