简体   繁体   English

编译器无法解析模块

[英]Compiler can't resolve modules

I am using Visual Studio 2013 Update 2 with Web Essentials latest version. 我正在使用Visual Studio 2013 Update 2和Web Essentials最新版本。

At the moment typescript is giving me a hard time as AMD compiling does not seem to be reliable. 目前,打字稿给我带来了麻烦,因为AMD编译似乎并不可靠。 Most of the time intellisense is happy with the module path (not always) but the compiler never accepts it. 大多数情况下,智能感知对模块路径感到满意(并非总是如此),但是编译器从不接受它。

This is what my file structure looks like: 这是我的文件结构:

-scripts
  -app
    -controls
      FeedbackControl.ts
    -models
      FeedbackModel.ts

FeedbackControl.ts FeedbackControl.ts

import model = require("../models/feedbackmodel");
export class FeedbackControl{
    constructor(){}
}

FeedbackModel.ts FeedbackModel.ts

export class FeedbackModel{
  constructor(){}
}

This looks valid to me and even the IDE is ok with it. 这对我来说似乎是有效的,甚至IDE也可以。 But when I try to compile this is what the compiler thinks: 但是,当我尝试编译时,这就是编译器的想法:

Build: Unable to resolve external module '"../models/feedbackmodel"'. 内部版本:无法解析外部模块“ ../models/feedbackmodel”。

On a side node: Now and then the IDE is showing me such errors, too. 在一个侧面节点上:IDE有时也会向我显示此类错误。 A restart of visual studio helps. 重新启动Visual Studio会有帮助。 What always leads to an error is when I do not use lower case characters in module path only. 总是导致错误的是,我仅在模块路径中不使用小写字符。 Like so: 像这样:

import model = require("../models/FeedbackModel");

I have no idea what I need to do to get this fixed. 我不知道该如何解决。 My team mates are having this issue, too, so I guess there is something wrong with the solution. 我的队友也有这个问题,所以我想解决方案有问题。 As a workaround we disabled typescript compiling on each .ts file. 作为解决方法,我们禁用了每个.ts文件上的打字稿编译功能。

import语句的字符串框(即/models/FeedbackModel需要与文件系统中使用的大小写匹配。

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

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