[英]How to create tsconfig.json file in angular2 project?
I have created one angular2 project using npm. 我用npm创建了一个angular2项目。 I was referring this link: Angular2 Tutorial 我指的是这个链接: Angular2 Tutorial
I succeessfully created the package.json
file using npm init
command. 我使用npm init
命令成功创建了package.json
文件。 But I didnt find any command to create tsconfig.json
file. 但我没有找到任何创建tsconfig.json
文件的命令。 I am not sure that should I create that file using command or using editor? 我不确定我应该使用命令还是使用编辑器创建该文件? Thanks in advance. 提前致谢。
使用init
选项调用TypeScript编译器将在当前目录中创建新的tsconfig.json
tsc --init
To complement the Vadim's answer, the tsc command is available after having installed TypeScript: 为了补充Vadim的答案,安装TypeScript后可以使用tsc命令:
$ npm install -g typescript
You can also use some parameters with this comment: 您还可以在此评论中使用一些参数:
$ tsc --init --experimentalDecorators
--moduleResolution node --target ES5
--sourceMap --module system --removeComments
This way, you're very close to what Angular.io uses for this samples. 这样,您就非常接近Angular.io用于此示例的内容。
You can then remove the outDir
and rootDir
entries if not needed. 然后,如果不需要,您可以删除outDir
和rootDir
条目。 Moreover an entry isn't generated this way. 此外,不会以这种方式生成条目。 You can add it manually in the generaed tsconfig.json
file. 您可以在生成的tsconfig.json
文件中手动添加它。
"emitDecoratorMetadata": true
Hope it helps you, Thierry 希望它对你有帮助,蒂埃里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.