看起来,从类型记录到ES6到ES5,所有内容都被正确编译。但是,我一直收到以下错误。我不知道是什么导致了这个错误..。
error TS1204: Cannot compile external modules into amd or commonjs when targeting es6 or higher.设置:
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 ]
}发布于 2015-07-15 19:53:59
这个错误告诉我们所有的事情:
无法将外部模块编译为针对es6或更高版本的amd或公共项。
ES6有内置的模块,所以从tsconfig.json中删除这一行
"module": "commonjs",然后,既然您正在用babel从ES6编译到ES5,那么告诉它编译到CommonJS:
babel --modules common ...etc...https://stackoverflow.com/questions/31438214
复制相似问题