aspect-build / aspect-build/rules_oxc

[FR]: Read configuration from `tsconfig.json`

Open
#77 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Starlark
Stars
1
Forks
1
Avg merge
3h 44m
Merged PRs (30d)
67

Description

### What is the current behavior?

All configuration has to be passed in explicitly to `oxc_transpiler()`:

```starlark
transpiler = partial.make(
oxc_transpiler,
out_dir = "dist",
root_dir = "src",
target = "es2019",
experimental_decorators = False,
),
```

I understand that this is necessary for things like `out_dir` and `root_dir` that affect which files are emitted where.

### Describe the feature

It would be awesome if `rules_oxc` could read as much of its config as possible from the project's `tsconfig.json` file.

One of my biggest gripes with `rules_swc` (and with SWC in general) is needing to juggle a separate `.swcrc` config file and keep it in sync with `tsconfig.json`. Looking at issues like [this](https://github.com/swc-project/swc/issues/1348), I don't think SWC is likely to ever go this direction. But if we're already building and maintaining a custom CLI, there's no reason we couldn't do it here if we wanted to.

```starlark
transpiler = partial.make(
oxc_transpiler,
tsconfig ":tsconfig",
out_dir = "dist",
root_dir = "src",
),
```

This would also make it a lot easier for us to set transpilers once in a `ts_project()` wrapper -- which already has `out_dir` and `root_dir` -- and have everything else Just Work™.

There's some related prior art in Rolldown [here](https://github.com/rolldown/rolldown/blob/main/crates/rolldown_common/src/inner_bundler_options/types/tsconfig_merge.rs).

Contributor guide

Open the contributing guide

Research direction

Start at the oxc_transpiler configuration and determine which options can be read from the project's tsconfig.json, keeping out_dir and root_dir explicit as described. Compare the supported configuration with the Rolldown tsconfig_merge prior art; done means a tsconfig attribute supplies the applicable transpiler settings without a separate synchronized configuration file.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.