我正在尝试将AngularJS应用程序转换为使用TypeScript。但是,我编译的JS给我以下错误:
ReferenceError:未定义导出
tsconfig.json:
{
"compilerOptions": {
"outDir": "./built",
"allowJs": true,
"target": "es5"
},
"include": [
"components/**/*",
"factories/**/*"
]
}
header.component.ts:
import angular from "angular";
angular.module("playerEvaluator", ["ui.router", "ngMaterial"])
.component('headerComponent',
{
templateUrl: "templates/header.tmpl.html",
controllerAs: "$ctrl",
bindings: {},
controller: function ($scope, $state, $rootScope) {
//Pages
this.pages = [
{
name: "Teams",
state: "teams"
}
];
//Go to selected page
this.goToPage = (state: string) => {
$state.go(state)
}
}
});
正是这一行在 header.component.js中抛出错误:
Object.defineProperty(exports, "__esModule", { value: true });
如何解决此错误?