aspect-build / aspect-build/rules_ts

[FR]: Add env argument to ts_project

Open
#855 1 comment 0 reactions 0 assignees View on GitHub
documentation enhancement
Dominant language
Starlark
Stars
138
Forks
87
Avg merge
2d 8h
Merged PRs (30d)
3

Description

### What is the current behavior?

Currently there is no way to customize the environment variables that are set during the tsc execution.

### Describe the feature

I am attempting to adopt ts_project on my very large Typescript codebase. In order to use `tsc` without running out of memory, we need to use the `--max-old-space-size` on the node process. ts_project does not currently provide a way to do this. I propose adding an `env` option to ts_project that gets passed though to the underlying action run.

Currently, our setup looks like this:
```
typescript_bin.tsc(
name = "src_transpiled",
args = [
"-p",
"tsconfig.json",
],
chdir = package_name(),
out_dirs = ["dist"],
srcs = glob([
"src/**/*"
]) + [
"tsconfig.json",
],
env = {
"NODE_OPTIONS": "--max-old-space-size=10240",
},
visibility = ["//visibility:public"],
)

```

Contributor guide

Open the contributing guide

Research direction

Start by locating the ts_project implementation and the underlying action invocation referenced in the issue. Add the env option so values such as NODE_OPTIONS reach the tsc execution, then verify that a ts_project target can customize its environment without changing existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.