Editing a typescript project, that was created on VisualStudio, in WebStorm is replying this error:
Error:(1, 1) TS1148: Cannot compile external modules unless the '--module' flag is provided.
the code is simple like this:
in file Test.ts
class helloWorld{
}
export = helloWorld;
Thanks in advance for your help
EDITED
I forgot to mention that I was using a MAC.
Also after enter the post, on my quest to find the solution, I try to compile the web in VisualStudio Code for Mac, and I have the same problem there, that, make realize that the problem was not the IDE but something in common, that I didn't figure it out.
On fedemp answer this sentence trigger someting:
One is using the flag at compilation: tsc --module commonjs or --module amd.
So I go to Webstorm's Preferences -> Languages & Frameworks -> TypeScript and on the option "Command line options:" I added --module amd and done!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With