![](/img/trans.png)
[英]TypeScript "Compile on save" feature not working in Visual Studio 2015
[英]Bundle typescript files in Visual Studio without loosing Browserlink feature
Visual Studio 可以在保存時自動編譯打字稿文件。 當使用瀏覽器鏈接時,它也會自動將瀏覽器更新為最新版本。
有沒有辦法在不丟失此功能的情況下在 Visual Studio 中捆綁打字稿文件? 代碼應在保存時重新編譯,並通過瀏覽器鏈接自動在瀏覽器中可用。
無論哪種解決方案都需要能夠解析 es6 模塊! 我在整個網絡上找到了一些解決方案,但他們大多使用 webpack(速度很慢)並且沒有提及它是否適用於 browserlink
您可以使用 Cloud Mate ( https://angrymonkeycloud.com/mate ) 但不確定瀏覽器鏈接!
它使用 gulp 編譯、捆綁和縮小 TypeScript 文件,而無需編寫 gulp 復雜配置。
npm install -g cloudmate
{
"files":
[
{
"output": ["js/index.js"],
"input": ["src/file1.ts", "src/file2.ts"]
}
],
"builds":
[
{
"name": "dev", // important
"js": {
"minify": true,
"sourceMap": true,
"declaration": false,
"webClean": true // important to make it work on browsers
},
"ts": {
"compilerOptions": { // this is my working configuration
"target": "es5",
"noEmitOnError": false,
"noImplicitAny": false,
"module": "ES6"
"lib": [ "ES2015", "DOM" ]
}
}
}
]
}
cd {mateconfig.json file path}
cloudmate -w // -w to keep watching files for updates
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.