Skip to content

[FR]: Add env argument to ts_project #855

@jamirvin

Description

@jamirvin

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"],
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions