This repository contains the code from my blog post "Building TypeScript with Bazel".
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
MIT
Simple demo for building a TypeScript project with Bazel.
Home Page: https://blog.mgechev.com/2018/11/19/introduction-bazel-typescript-tutorial/
This repository contains the code from my blog post "Building TypeScript with Bazel".
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
MIT
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.