Saturday, May 23, 2015

Custom Bazel build rules to compile TypeScript

I've written a Skylark module for Bazel to compile TypeScript projects. Source code and example build files are available at

Two new rules are introduced by typescript.bzl: ts_library (to group TypeScript modules) and ts_binary (to compile TypeScript sources into a single JavaScript file). Additional compiler options may be passed to tsc via the optional flags attribute as shown below.

  name = "externs",
  srcs = ["externs.d.ts"],

  name = "common",
  srcs = ["common.ts"],
  deps = [":externs"],

  name = "main"
  srcs = ["main.ts"],
  deps = [":common"],
  flags = [

1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from TypeScript Training in Chennai . or learn thru Javascript Online Training from India. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Training in Chennai