与 Node.js 一起使用时,我想将 TypeScript 编译为一个文件。
我试过像这样配置“tsconfig.json”:
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": false,
"sourceMap": false,
"outFile": "./app/index.js",
"pretty": true,
"types": [
"node"
]
}",
...但是当我尝试使用module" set to
“commonjs”`时,我得到了错误:
error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile.
如果我将其更改为"module": "system"
,则在以下位置运行文件时会出现此错误node
:
ReferenceError: System is not defined
如果我更改module
为"amd"
,则在以下位置运行文件时会出现此错误node
:
ReferenceError: define is not defined