Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio not compiling TypeScript

I have a Visual Studio project with a structure like so:

Folder structure

My tsconfig.json looks like:

{
  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5",
    "outDir": "../wwwroot/"
  },
  "exclude": [
    "node_modules",
    "wwwroot"
  ]
}

However, VS isn't compiling the app.ts into the wwwroot folder.

What am I missing?

like image 651
BanksySan Avatar asked May 16 '16 20:05

BanksySan


People also ask

Can TypeScript be compiled?

Running tsc locally will compile the closest project defined by a tsconfig.json , you can compile a set of TypeScript files by passing in a glob of files you want.

Why is Vscode not compiling?

The reason is that the default shell in visual studio code is powershell, which doesn't check the current directory. To change the default shell to command prompt, follow these steps. Open vscode and enter the shortcut ctrl + `.


1 Answers

Try adding "compileOnSave": true to your tsconfig.json:

{
    "compilerOptions": {
        "noImplicitAny": false,
        "noEmitOnError": true,
        "removeComments": false,
        "sourceMap": true,
        "target": "es5",
        "outDir": "../wwwroot/"
     },
     "exclude": [
        "node_modules",
        "wwwroot"
    ],
    "compileOnSave": true
}

It should compile every time you save now.

like image 78
ericbowden Avatar answered Oct 23 '22 11:10

ericbowden