Ste*_*ett 8 babeljs babel-plugin vue-cli
在我的 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'],
};
Run Code Online (Sandbox Code Playgroud)
现在错误信息似乎倒退了,根本没有提到操作员名称:
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);
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
对我来说,该@babel/plugin-syntax-nullish-coalescing-operator插件无法工作,而这正是您正在使用的插件。
我必须使用@babel/plugin-proposal-nullish-coalescing-operator错误消息建议您使用的插件。
此外,我在插件页面上注意到了这一点@babel/plugin-syntax-nullish-coalescing-operator:
我不能肯定地说这是否能解决你的问题,但它确实解决了我的问题
| 归档时间: |
|
| 查看次数: |
1173 次 |
| 最近记录: |