js @装饰器报语法错误解决方法

UnhandledPromiseRejectionWarning: SyntaxError: /home/tree/桌面/item/node/ice/server/router/wechat.js: Unexpected token (9:0)
  7 |  
  8 | console.log(controller)
>  9 | @controller('') //给类添加一个属性symbolPrefix:‘’
    | ^
 10 | export class WxController {

 

 

 

npm i --save-dev babel-plugin-transform-decorators-legacy
.babelrc
{

"presets": ["env"],
"plugins": ["transform-decorators-legacy"]
}

 

猜你喜欢

转载自blog.csdn.net/supertree_l/article/details/88622208
0条评论
添加一条新回复