【发布时间】:2020-07-04 12:40:56
【问题描述】:
在我的 Vue-CLI 项目中,当我尝试使用 ?? 运算符时,我收到了这个错误:
语法错误:SyntaxError: /Users/stevebennett/odev/freelancing/v-map/src/components/Map.vue: >目前未启用对实验语法“nullishCoalescingOperator”的支持 (30:29):
...
将 @babel/plugin-proposal-nullish-coalescing-operator (https://git.io/vb4Se) 添加到 Babel 配置的“插件”部分以启用转换。
我安装了@babel/plugin-syntax-nullish-coalescing-operator(它的名字好像变了),添加到我的babel.config.js:
module.exports = {
presets: ['@vue/app'],
plugins: ['@babel/plugin-syntax-nullish-coalescing-operator'],
};
现在错误信息似乎已经倒退了,根本没有提到运营商名称:
Module parse failed: Unexpected token (39:35)
You may need an appropriate loader to handle this file type.
| case 8:
| points = _context.sent;
console.log(sheetID ?? 37);
我做错了什么?
【问题讨论】:
标签: babeljs vue-cli babel-plugin