Typescript bundled compiler (WS 10) gives "Cannot compile external modules unless the '--module' flag is provided."

Hi there,

I have a simple file that tries to export something i.e.

 
class Client {
    constructor(public name: string, public description: string) { }
}
export = Client;


but this produces the following error message

Error:(8, 1) TS1148: Cannot compile external modules unless the '--module' flag is provided.


I have entered under the the command line options box (language and framworks / typescript .. File / default settings)

--module commonjs

but still it persists.

any ideas ?

module typescript error.png

0
3 comments
Avatar
Permanently deleted user

Hello Ian -

Was just about to ask the same question. My settings match yours, I've also tried:

-m common js
--module amd
-m amd

in line with the instructions, but still TS1148.

Got that with Visual Studio this morning, but adding command line args resolved. That was on Windows, I'm on Mac tonight.

I'll try WebStorm on Windows tomorrow, see if that works.

Duncan

0
Avatar
Permanently deleted user

Hey Duncan,

I think I figured it out, rather than doing File, Default Settings..

Try in Preferences, say set of options...

That appears to work.

Hope that helps.

0
Avatar
Permanently deleted user

Outstanding! Thanks Ian, works perfectly.

Duncan

0

Please sign in to leave a comment.