问题
I have created a dummy basic project in VS2015 Community Update 3, Version 14.0.25424.00. (Using this great tutorial: aspnet-core-web-api-angularjs-2 ).
This angular-2 project has some .ts files.
The problem:
Instead of being transpiled ("compiled") to .js files every time a file is being saved, the .ts files being transpiled once and only at BUILD time of the SERVER-SIDE project. (clicking F5 from visual studio).
I google it and found out that I should add "watch": true to the tsconfig.json file:
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "system",
"moduleResolution": "node",
"watch": true
},
"exclude": [
"node_modules",
"wwwroot/lib"
]
}
However, now I am getting an error at BUILD time: Error 'JsErrorScriptException (0x30001)'. ASPNETCoreAngular2Demo C:\Visual Studio 2015\Projects\ASPNETCoreAngular2Demo\src\ASPNETCoreAngular2Demo\Unknown output 1
According to this post, the solution in VS2015 update 2 is to add to the tsconfig file:
"compileOnSave": true
However, this didn't work for me in my update 3 version.
From the cmd I run the following:
>tsc -v Version 1.0.3.0
Which I think is pretty old but I don't know how to update it, because running:
>npm install -g typescript@* --save
didn't change the current version.
What do you suggest? I am desperate..
TNX,
回答1:
WoW, poor Microsoft..
The issue here is that on installing VS2015, I got TypeScript 1.8, But it didn't update the PATH env variable of Windows 10, So I was actually using the 1.0 version.
I had to update it manually with the help of THIS POST .
(be aware of the comment there to use "compileOnSave": true on win10 os).
Now it's WORK (-;
来源:https://stackoverflow.com/questions/39021808/vs2015-adding-watch-true-to-tsconfig-json-causing-jserrorscriptexception-0x