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
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 systemcommonjs- module system
i hope can solve problem! luck!

Comments
Post a Comment