2016-12-06 48 views
2

我安装了Visual Studio代码(版本1.7.2)并打印了1.8版本。我已经在一个文件夹中构建了一个简单的react-native项目。 (反应应用程序工作得很好,因为我可以在调试器中运行它)。现在我尝试整合打字稿。但vs代码不会在保存(ctrl + s)和构建(ctrl + b)上都不传输我的代码。这里是我的tsconfig.json文件(位于我的项目的根目录):vs code not transpiling ts files

{ 
    "compilerOptions": { 
    "target": "es5", 
    "module": "commonjs",  
    "sourceMap": true, 
    "noImplicitAny": true   
    }, 
    "compileOnSave": true, 
    "exclude": [ 
    "node_modules" 
    ] 
} 

这里是tasks.json文件:为VS代码能够挑语法错误从

{ 
    // See https://go.microsoft.com/fwlink/?LinkId=733558 
    // for the documentation about the tasks.json format 
    "version": "0.1.0", 
    "command": "C:\\Program Files (x86)\\Microsoft SDKs\\TypeScript\\1.8\\tsc", 
    "isShellCommand": true, 
    "args": ["-p", "."], 
    "showOutput": "always", 
    "problemMatcher": "$tsc" 
} 

编译发生就好了测试文件calle“mytest.ts” 但是在保存或构建时没有生成“mytest.js”文件。我已按照此指示https://code.visualstudio.com/Docs/languages/typescript

仍然我无法获得vs代码transpile我的代码。

任何帮助,暗示朝着正确的方向将不胜感激。

预先感谢您

回答

1

我终于能够通过修改tasks.json文件中像这样来解决我的问题:

{ 
    ... 

    "args": ["-p", "${workspaceRoot}"], 

    ... 

}