Angular2代码中的TypeScript错误:找不到名称“模块”
我定义了以下Angular2组件: import {Component} from 'angular2/core'; @Component({ selector: 'my-app', moduleId: module.id, templateUrl: './app.component.html' }) export class AppComponent { } 当我尝试对此进行编译时,在第5行出现以下错误: src/app/app.component.ts(5,13): error TS2304: Cannot find name 'module'. 我相信module.id指的是CommonJSmodule变量(请参阅此处)。我在tsconfig.json中指定了CommonJS模块系统: { "compilerOptions": { "target": "es5", "module": "commonjs", "declaration": false, "removeComments": true, "noLib": false, "emitDecoratorMetadata": true, "experimentalDecorators": true, "sourceMap": true, "pretty": true, "allowUnreachableCode": false, …