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