user971374
user971374

Reputation: 153

Visual studio TypeScript error "Cannot compile modules unless the '--module' flag is provided."

When trying to compile and export a typescript module I get this error. I have read a few articles but none fix my problem, I am using VS2015 Exterprise, Thanks

Upvotes: 5

Views: 909

Answers (2)

M. van der Corput
M. van der Corput

Reputation: 21

I ran into this problem a while ago myself and probably your visual studio project file is messed up. This can either be because of a Visual Studio bug or because you have used a messed up project file.

I described what fixed it for me in this post.

Upvotes: 0

basarat
basarat

Reputation: 276205

Visual studio TypeScript error “Cannot compile modules unless the '--module' flag is provided.”

Right click the project and select "properties". Click on the TypeScript page in the project properties and then select your module (I personally recommend commonjs with webpack for frontend/browser or as is for nodejs)

Upvotes: 2

Related Questions