简体   繁体   English

Visual Studio 2013没有找到从typescript编译的javascript文件?

[英]Visual Studio 2013 not finding javascript files compiled from typescript?

I'm using VS 2013 Community Edition Update 4 with Web Essentials, and when I add a new typescript file and save it, the .js file is generated. 我正在使用带有Web Essentials的VS 2013社区版Update 4,当我添加新的打字稿文件并保存它时,会生成.js文件。

But then when I try to add it to the index VS doesn't sense the .js to autocomplete the href attribut in the <script> tag. 但是当我尝试将其添加到索引时,VS不会感知.js自动完成<script>标记中的href attribut。

If I add it by hand it works, the app works, the .js was generated but it doesn't seem to be part of the project, but it's a bit annoying to me. 如果我手动添加它可以工作,应用程序工作,生成.js但它似乎不是项目的一部分,但它对我来说有点烦人。

Does anyone have a solution or something I'm missing ? 有没有人有解决方案或我缺少的东西?

In the solution explorer click the 在解决方案资源管理器中单击

在此输入图像描述

icon, then right click on the .js file on the project tree and press include in project. 图标,然后右键单击项目树上的.js文件,然后按项目中的include。 Once the file is part of your project VS will autosuggest this file for href references. 一旦文件成为项目的一部分,VS将自动提供此文件以进行href引用。

With VS2015 you merely drag the TS file onto the editor. 使用VS2015,您只需将TS文件拖到编辑器上即可。 You will find that a JS tag is inserted in your code. 您会发现代码中插入了JS标记。 This does not work in VS2013. 这在VS2013中不起作用。


I have removed the method for rewriting URLs because it interferes with use of source mapping to directly debug typescript in VS and in the browser. 我已经删除了重写URL的方法,因为它干扰了使用源映射来直接调试VS和浏览器中的typescript。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM