GithubHelp home page GithubHelp logo

mgechev / bazel-demo Goto Github PK

View Code? Open in Web Editor NEW
40.0 3.0 8.0 45 KB

Simple demo for building a TypeScript project with Bazel.

Home Page: https://blog.mgechev.com/2018/11/19/introduction-bazel-typescript-tutorial/

TypeScript 82.02% Python 17.98%
bazel bazel-examples typescript

bazel-demo's Introduction

Bazel TypeScript Demo

This repository contains the code from my blog post "Building TypeScript with Bazel".

Usage

To setup the project run:

yarn

To build the project:

./node_modules/.bin/bazel build :bundle

Execute the produced bundle:

node bazel-bin/bundle.js

License

MIT

bazel-demo's People

Contributors

mgechev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bazel-demo's Issues

IDE TS2307 Cannot find module 'lang/*'.ts

Hi,
Cloning the project and opening the test.ts file (in either WebStorm or VS Code) I see my IDE cannot resolve any of the three imports from the lang folder. After I add the following my IDE is satisfied and I get the intellisense I'd expect (the baseUrl and the paths are what I've added.)

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "strict": true,
    "noImplicitAny": false,
    "baseUrl": "./",
    "paths": {
      "lang/*": [
        "./*"
      ]
    }
  },
  "bazelOptions": {
    "workspaceName": ""
  }
}

I then however see the following from Bazel after building.

[jallen@laptop bazel-demo]$ ./node_modules/.bin/bazel build :bundle
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
INFO: Analyzed target //:bundle (212 packages loaded, 5721 targets configured).
INFO: Found 1 target...
INFO: From Compiling TypeScript (devmode) //lexer:lexer:

WARNING: your tsconfig.json file specifies options which are overridden by Bazel:
 - compilerOptions.paths is determined by the module_name attribute in transitive deps[]
 - compilerOptions.rootDir and compilerOptions.baseUrl are always the workspace root directory


INFO: From Compiling TypeScript (prodmode) //lexer:lexer:

WARNING: your tsconfig.json file specifies options which are overridden by Bazel:
 - compilerOptions.paths is determined by the module_name attribute in transitive deps[]
 - compilerOptions.rootDir and compilerOptions.baseUrl are always the workspace root directory


INFO: From Compiling TypeScript (devmode) //parser:parser:

WARNING: your tsconfig.json file specifies options which are overridden by Bazel:
 - compilerOptions.paths is determined by the module_name attribute in transitive deps[]
 - compilerOptions.rootDir and compilerOptions.baseUrl are always the workspace root directory


INFO: From Compiling TypeScript (prodmode) //parser:parser:

WARNING: your tsconfig.json file specifies options which are overridden by Bazel:
 - compilerOptions.paths is determined by the module_name attribute in transitive deps[]
 - compilerOptions.rootDir and compilerOptions.baseUrl are always the workspace root directory


INFO: From Compiling TypeScript (devmode) //interpreter:interpreter:

WARNING: your tsconfig.json file specifies options which are overridden by Bazel:
 - compilerOptions.paths is determined by the module_name attribute in transitive deps[]
 - compilerOptions.rootDir and compilerOptions.baseUrl are always the workspace root directory


INFO: From Compiling TypeScript (prodmode) //interpreter:interpreter:

WARNING: your tsconfig.json file specifies options which are overridden by Bazel:
 - compilerOptions.paths is determined by the module_name attribute in transitive deps[]
 - compilerOptions.rootDir and compilerOptions.baseUrl are always the workspace root directory


INFO: From Compiling TypeScript (prodmode) //:app:

WARNING: your tsconfig.json file specifies options which are overridden by Bazel:
 - compilerOptions.paths is determined by the module_name attribute in transitive deps[]
 - compilerOptions.rootDir and compilerOptions.baseUrl are always the workspace root directory


Target //:bundle up-to-date:
  bazel-bin/bundle.min.js
  bazel-bin/bundle.min.js.map
INFO: Elapsed time: 33.207s, Critical Path: 13.65s
INFO: 10 processes: 10 linux-sandbox.
INFO: Build completed successfully, 51 total actions
[jallen@laptop bazel-demo]$ 

Are the TypeScript warnings above expected?.. or is there a more proper Bazel + TypeScript approach?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.