cannot compile external modules unless the '--module' flag is provided

Prasanjit Dey picture Prasanjit Dey · May 20, 2015 · Viewed 7.2k times · Source

Problem while using visual studio code with angularjs2 and Typescript 1.5beta.

Error:(3, 1) TS1148: Cannot compile external modules unless the '--module' flag is provided.
Error:(6, 1) TS1205: Decorators are only available when targeting ECMAScript 5 and higher.

I can run the same code using the commandline compiler using tsc -t es5 -m commonjs app.ts.The same problem occours with webstorm 10.0.2 as well.

Answer

wizkidblake picture wizkidblake · Jul 10, 2015

This is how I solved it in Webstorm/IntelliJ

File>Settings>Languages & Frameworks > TypeScript

Command Line options:

-m amd -t ES5