我正在 Visual Studio 中使用 Aurelia 构建一个网站,它具有 babel 转译器,我的配置文件如下所示
babelOptions: {
"optional": [
"optimisation.modules.system",
"es7.decorators",
"es7.classProperties",
"es7.asyncFunctions",
"runtime"
]
},
Visual Studio 报告错误。Expected ';'
在第 4 行。然而,这似乎是正确的语法,app.js 可以工作,我可以浏览到 app.html,而不会在控制台中出现任何问题。这是有问题的代码。
export class App {
message = "Hello Aurelia";
configureRouter(config, router) { /// <--- Expected ';'
this.router = router;
config.title = 'Aurelia';
config.map([
{ route: ['', 'home'], name: 'home', moduleId: 'home/index' },
]);
};
};
如果我尝试使用更标准的 javascript 行
let configureRouter = function(config, router) {};
或者
this.configureRouter = function(config, router) {};
Visual Studio 没有报告任何问题,但 AureliaError: (SystemJS) http://localhost:57366/src/app.js: Unexpected token (4:8)
在控制台中抛出了上述两个问题。
知道如何让 Visual Studio 使用与 babel 转译器相同的智能感知吗?或者可能是什么问题?