在 Visual Studio 2015 中从 *.ts 生成 *.js [英] Generated *.js from *.ts in Visual Studio 2015

查看:28
本文介绍了在 Visual Studio 2015 中从 *.ts 生成 *.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将 *.ts 文件添加到 Visual Studio 2015 并编译时,*.js 文件不是 *.ts 的代码隐藏文件.它只是驻留在文件夹中,而不是 Visual Studio 项目的一部分.

When I add a *.ts file to Visual Studio 2015 and this get compiled, the *.js file isn't a code behind file of the *.ts. It just resides in the folder and it's not part of the visual studio project.

这是设计使然还是我破坏了项目中的某些东西?

Is that by design or did I break something in my project?

如果是设计使然,背后的动机是什么?(如果我想查看文件,我必须显示隐藏文件并最终点击刷新按钮...)

If it is by design, what is the motivation behind? (If i want to have a look at the file i have to show hidden files and eventually hit the refresh button... )

推荐答案

这是设计使然 - JavaScript 文件是构建工件,就像 DLL 一样.

This is by design - the JavaScript file is a build artefact, just like a DLL.

这个想法是您签入您的 TypeScript 代码并允许构建服务器创建您的 JavaScript 文件.虽然您可能在调试"模式下运行,但构建服务器可以在发布"模式下生成它们,这可能会启用更多优化.

The idea is that you check in your TypeScript code and allow the build server to create your JavaScript files. While you may be running in "Debug" mode, the build server can generate them in "Release" mode, which may have more optimisations enabled.

这篇关于在 Visual Studio 2015 中从 *.ts 生成 *.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆