看起来从 Typescript 到 ES6 到 ES5 的所有内容都被正确编译。但是,我不断收到以下错误。我无法弄清楚是什么导致了这个错误......
error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.
设置:
- 已安装 typescript 1.5.0-beta (npm install -g typescript@1.5.0-beta)
- tsconfig.json 文件如下所示。
- 使用了两个文件夹 src(所有 *.ts 文件)和 typings(外部库 *.d.ts 文件)。
- Atom 编辑器填写 tsconfig.json 中“files”属性中的所有内容
- ES6 文件使用 Babel 编译成 ES5
tsconfig.json:
{
"version": "1.5.0-beta",
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"emitDecoratorMetadata": true,
"declaration": false,
"noImplicitAny": false,
"removeComments": true,
"noLib": false,
"preserveConstEnums": true,
"suppressImplicitAnyIndexErrors": true,
"sourceMap": true,
"outDir": "build"
},
"filesGlob": [
"./src/**/*.ts",
"./typings/**/*.ts",
"!./node_modules/**/*"
],
"files": [ redacted ]
}