尝试对模块和目标有一些基本的了解。TypeScript编译选项:module vs target
我想知道模块之间的差异和目标编译典型tsconfig.json
{ "compilerOptions": { "module": "es6", "sourceMap": true, "target": "es6" } }
,如果我提供了以下选项,会发生什么选项:
模块:CommonJS的,目标:ES6
模块:ES6,目标:CommonJS的
模块:CommonJS的,目标:CommonJS的
目标不能是commonjs。它只能是:'es3'(默认),'es5'或'es6'。你有没有读过[Compiler Options doc](https://www.typescriptlang.org/docs/handbook/compiler-options.html)? –
Paleo的答案是一个重要的修正:[Documentation](https://www.typescriptlang.org/docs/handbook/compiler-options.html)实际上表示可以使用>>“ES6”和“ES2015”值** **定位时**“ES5”或更低**。<< – Peti29