admin管理员组文章数量:1320800
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?
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?
Share Improve this question edited Oct 2, 2019 at 19:30 Mike K asked Oct 2, 2019 at 19:16 Mike KMike K 6,52117 gold badges75 silver badges144 bronze badges 6- Maybe silly question but did you install the packages npm insall/ yarn add? – dreijntjens Commented Oct 4, 2019 at 7:51
- I have, yes lol – Mike K Commented Oct 4, 2019 at 8:00
- Are you using webpack? If so could you add the webpack.config.js? – dreijntjens Commented Oct 4, 2019 at 9:10
-
Adding those plugins to my webpack config worked for me in removing that error message. I think instead of adding those plugins to the
package.json
, try adding it to your webpack config -- under theoptions
key for thebabel-loader
rule/entry. Another possibility is adding it to your.babelrc
file (if you have one in your project). – Venryx Commented Nov 26, 2019 at 11:49 -
Not a direct solution since I can't know what your setup is, but: Search for any
@babel/plugin-proposal-
across the codebase. It may live in multiple files, sometimes twice in the same file. This has worked for me. – diogo Commented Aug 10, 2020 at 13:56
2 Answers
Reset to default 2Okay I am bit late here, but I can see the question is still active, for those e 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
本文标签:
版权声明:本文标题:javascript - Error: Support for the experimental syntax 'optionalChaining' isn't currently enabled, but 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742089674a2420188.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论