TypeScript 0.9.* VisualStudio TS5037:除非提供'--module'标志,否则无法编译外部模块 [英] TypeScript 0.9.* VisualStudio TS5037: Cannot compile external modules unless the '--module' flag is provided
问题描述
我确实收到TypeScript编译器错误 TS5037:除非提供'--module'标志,否则无法编译外部模块.
I do get the TypeScript compiler error TS5037: Cannot compile external modules unless the '--module' flag is provided.
我正在使用 TypeScript 0.9.1.1 和 Visual Studio 2012 .
我在哪里可以在Visual Studio中设置-module 选项?
Web Essential似乎不再在对话框中支持此选项.
Where can I set the --module option in Visual Studio?
Web Essential seems to no longer support this option in the dialog.
哈里,谢谢
更新:
我的项目有一个配置文件(config.ts).该文件包含许多语句,如下所示:
Update:
I have a configuration file (config.ts) for my project. This file contains many statements as the following:
export var loggedInUserId: number = 0;
没有其他陈述.我是否必须围绕它定义一个类或模块?
There are no other statements as the one before. Do I have to define a class or module around it?
推荐答案
即使上述设置正确设置,我在Visual Studio 2013中仍遇到此问题.事实证明,还有一个项目级别的设置.如果您使用TypeScript转到项目上的项目设置"(突出显示该项目并键入Alt + Enter),则转到"TypeScript生成"选项卡,然后在模块系统"下选择AMD
I was having this problem in Visual Studio 2013, even with that setting above set correctly. It turns out there's a project-level setting as well. If you go to Project Settings on the project with TypeScript (highlight the project and type Alt+Enter), then go to the TypeScript Build tab, and select AMD under "Module System"
这篇关于TypeScript 0.9.* VisualStudio TS5037:除非提供'--module'标志,否则无法编译外部模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!