繁体   English   中英

启用tsconfig.json以为.js文件compileOnSave

[英]Enable tsconfig.json to compileOnSave for .js files

我正在使用Visual Studio Professional 2015 Update 3和TypeScript 2.8.4。 我有一个简单的项目

Scripts/
└── Widgets/
    ├── main.ts
    └── tsconfig.json

main.ts

console.log("Hello, world!");

tsconfig.json

{
    "compileOnSave": true,
    "compilerOptions": {
        "allowJs": true,
        "noImplicitAny": false,
        "noEmitOnError": true,
        "removeComments": false,
        "sourceMap": true,
        "target": "es5",
        "outFile": "dist/widgets.js"
    },
    "exclude": [
        "dist"
    ]
}

compileOnSave设置可以像这样正常工作。 但是,当我将main.ts更改为main.js时,即使设置了allowJs设置,它也不会在保存时编译。 对于扩展名为.js文件,我可以做些什么使compileOnSave工作吗?

这在Visual Studio 2015中是不可能的。它应该在Visual Studio 2017中起作用。

参见https://github.com/Microsoft/TypeScript/issues/14536

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM