typescript - Visual studio Code : Connot compile module unless the --module flag is provided -


i getting error typescript code file , seems common error unable fix that. new visual studio code.

cannot compile modules unless '--module' flag provided 

enter image description here

so, understood problem - common exception , solve should analyse compiler options

so, if compile code on tasks.json can define several addition arguments compiler

{     "version": "0.1.0",      // command tsc. assumes tsc has been installed using npm install -g typescript     "command": "tsc",      // command shell script     "isshellcommand": true,      // show output window if unrecognized errors occur.     "showoutput": "silent",      // args helloworld program compile.     "args": ["-m", "commonjs", "helloworld.ts"],      // use standard tsc problem matcher find compile problems     // in output.     "problemmatcher": "$tsc" }    

so -m means --module compiler command.

edited

so, if use tsconfig.json, can find default configuration module settings here

"module": "commonjs":

  • module - flag tell compiler use module system
  • commonjs - module system

i hope can solve problem! luck!


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -