Skip to content

Commit 13caf8b

Browse files
authored
fix(typescript): pass rootDir to ts_project tsc actions (#1748)
1 parent 1a83a7f commit 13caf8b

4 files changed

Lines changed: 9 additions & 0 deletions

File tree

packages/typescript/src/internal/ts_project.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ def _ts_project_impl(ctx):
4747
ctx.file.tsconfig.short_path,
4848
"--outDir",
4949
"/".join([ctx.bin_dir.path, ctx.label.package]),
50+
# Make sure TypeScript writes outputs to same directory structure as inputs
51+
"--rootDir",
52+
ctx.label.package if ctx.label.package else ".",
5053
])
5154
if len(ctx.outputs.typings_outs) > 0:
5255
arguments.add_all([
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
load("@npm_bazel_typescript//:index.bzl", "ts_project")
2+
3+
# Ensure that subdir/a.ts produces outDir/subdir/a.js
4+
ts_project()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const a: string = 'hello';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

0 commit comments

Comments
 (0)