Samantha J T Star
Samantha J T Star

Reputation: 32828

Typescript compiling and changing filenames to lowercase all the time (VS2015)

I am using the latest VS2015 with the following options set in my project file for typescript:

  <PropertyGroup>
    <TypeScriptTarget>ES5</TypeScriptTarget>
    <TypeScriptCompileOnSaveEnabled>true</TypeScriptCompileOnSaveEnabled>
    <TypeScriptNoImplicitAny>false</TypeScriptNoImplicitAny>
    <TypeScriptModuleKind>AMD</TypeScriptModuleKind>
    <TypeScriptRemoveComments>false</TypeScriptRemoveComments>
    <TypeScriptOutFile></TypeScriptOutFile>
    <TypeScriptOutDir></TypeScriptOutDir>
    <TypeScriptGeneratesDeclarations>false</TypeScriptGeneratesDeclarations>
    <TypeScriptSourceMap>true</TypeScriptSourceMap>
    <TypeScriptMapRoot></TypeScriptMapRoot>
    <TypeScriptSourceRoot></TypeScriptSourceRoot>
    <TypeScriptNoEmitOnError>true</TypeScriptNoEmitOnError>
</PropertyGroup>

My problem is when it compiles a file:

UserService.ts it creates a userservice.js and a userservice.js.map

Which then contains //# sourceMappingURL=userservice.js.map

the userservice.js.map then has this line:

sources":["userservice.ts"]

Has anyone else seen this? I have tried recreating the files and same. This is causing me a lot of problems.

Follow up:

When I create a typescript file UserServicexxxx.ts everything works. When I delete all UserService files and create a UserService.ts then it goes back to doing what it did before.

I've been struggling now for 30 minutes or more trying to create UserService.ts, UserService.js and UserService.js.map :-(

Upvotes: 7

Views: 2758

Answers (1)

Chris Anderson
Chris Anderson

Reputation: 8515

This issue may be the cause: https://github.com/Microsoft/TypeScript/issues/2011

Have you checked that any files you reference UserService.ts from are correctly cased? If they are cased userservice.ts, it will compile to userservice.js, regardless of the actual casing of the ts file. They don't check this right now for performance reasons, but it creates odd bugs like this.

Clean your project and do a search for 'userservice.ts'. If you find one, change the case to the proper CamelCasing and recompile.

I've repro'd this issue here:

UserService.ts

UserService.ts

userService.ts

userService.ts

userservice.ts

userservice.ts

Check extra hard for any lingering links!

Upvotes: 10

Related Questions