Error: Support for the experimental syntax 'optionalChaining' isn't currently enabled, but it is

Viewed 6253

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?

2 Answers

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

Related