Search code examples
asp.netasp.net-mvcasp.net-mvc-5typescriptbundle

Using typescript in MVC5 application and do a bundle like compilation


I'm new to TypeScript and asked myself if it's possible to configure compilation of TypeScript like minification/bundling with JavaScript and the BundleConfig in MVC5.

My need is the following:

Before using TypeScript we had two js bundles: "bundles/external" and "bundles/internal".

The "internal" bundle has some logic, which we only want to expose to authenticated users.

But currently the VS TypeScript compiler can only be configured to compile and merge all .ts files into one.

Does anyone has a solution which could achieve this behaviour with a "compile on save" behaviour?


Solution

  • Does anyone has a solution which could achieve this behaviour with a "compile on save" behaviour?

    Overview of how you could (and I recommend) do it:

    Compile on save will now be faster! because it only needs to to compile individual files 🌹