I've followed the instructions here and here and I've added the following to my package.json
},
"babel": {
"plugins": [
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-optional-chaining"
]
},
"dependencies": {
But I'm still getting the error
Support for the experimental syntax 'optionalChaining' isn't currently enabled
What am I doing wrong here?
To enable optional chaining, you need to install a package. At the time of writing, optional chaining is not natively supported in Javascript, it is a new feature introduced in ES2020. Until it is fully adopted we can get all the optional goodness by installing a package!
Just put in the package. json "react-scripts": "^3.3. 0" and it will work.
Okay I am bit late here, but I can see the question is still active, for those come later:
At the time of writing, optional chaining might not work in NUXT project with node > 12, try using the current LTS version (node 12).
I think the issue might related to one or more dependencies of NUXT but we didn't investigate further, using node 12 resolves the issue for us.
I had a similar problem, I was using Vue CLI ,the reason is that the scaffolding version is too low (plugins installed separately seem to be ignored), you can check and upgrade your project scaffolding
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With