节点 JS 意外字符#。
班级:
export class Test{
#parent = null;
#name = null;
constructor(name, parent) {
this.#name = name;
if (parent) {
this.#parent = parent;
}
}
}
.babelrc:
{
"presets": [
"@babel/preset-env"
]
}
包.json:
"start": "babel-node"
我正在运行脚本“开始”并收到此错误:
SyntaxError: Unexpected character '#' (9:4)
7 |
8 | export class Test{
> 9 | #parent = null;
| ^
10 | #name = null;
版本:
-"@babel/core": "^7.8.7",
-"@babel/node": "^7.8.7",
-"@babel/preset-env": "^7.8.7",
-node: v12.16.2
-npm: 6.14.4
怎么修?
MMMHUHU
相关分类