Bundle typescript files in Visual Studio without loosing Browserlink feature

200 views Asked by At

Visual Studio can automatically compile typescript files on save. When the browserlink is used, it will also automatically update the browser with the latest version.

Is there a way to bundle typescript files in Visual Studio without loosing this feature? Code should be recompiled on save and automatically available in the browsers over the browserlink.

Whatever solution needs to be able to resolve es6 modules! I found a few solution throughout the web but they mostly use webpack (which is slow) and dont mention if it works with browserlink

1

There are 1 answers

0
Elie Tebchrani On

you can use Cloud Mate (https://angrymonkeycloud.com/mate) but not sure about browserlink!

It compiles, bundle, and minify TypeScript files using gulp without writing gulp complex configuration.

  1. Install cloud mate on your device globally from npm:
    npm install -g cloudmate
  1. Create JSON configuration file named "mateconfig.json" as below:
    {
        "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" ]
                    }
                }
            }
        ]
    }
  1. execute using CLI
    cd {mateconfig.json file path}
    cloudmate -w // -w to keep watching files for updates