Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ publish = false
crate-type = ["cdylib"]

[dependencies]
memchr = "2"
napi = { version = "3.12.2", default-features = false, features = ["serde-json", "napi3"] }
napi-derive = { version = "3.6.3", default-features = false, features = ["type-def"] }
oxc = { version = "0.148.0", features = [
Expand All @@ -22,6 +23,7 @@ oxc_resolver = { version = "11.24.3" }
oxc_sourcemap = "8"
phf = { version = "0.14", features = ["macros"] }
serde_json = "1"
simdutf8 = "0.1"
tracing = "0.1"
tracing-subscriber = { version = "0.3", default-features = false, features = [
"std",
Expand Down
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,26 @@ transform hook.

## Configuration

By default, `oxc-node` reads `tsconfig.json` from the current working directory.
Set `OXC_TSCONFIG_PATH` to use a different file. `TS_NODE_PROJECT` is also
supported and takes precedence when both variables are set.
By default, each file is governed by the nearest `tsconfig.json` in its own
ancestor directories that claims it through `files`, `include`, `exclude` or a
project reference — the same rule `tsc` follows. A file in a sub-project without
its own `tsconfig.json` therefore inherits the workspace root one, and a file
that no config claims is compiled with no options at all.

`include` only covers `.js`, `.jsx`, `.mjs` and `.cjs` files when `allowJs` is
enabled, so by default no config claims them and they are compiled with no
options. For **module resolution** they are matched as if they were TypeScript,
which keeps path aliases working from JavaScript without `allowJs`.

A `tsconfig.json` that fails to parse stops the search: that file and every
directory above it are skipped, and the file is compiled with no options.
Comments and trailing commas are fine — only genuinely invalid JSON does this.
Run with `OXC_LOG=debug` to see which config was picked for each file.

Set `OXC_TSCONFIG_PATH` to pin one config for every file instead. `TS_NODE_PROJECT`
is also supported and takes precedence when both variables are set; an empty value
counts as unset. Naming a file that does not exist disables `tsconfig.json`
handling entirely rather than falling back to the search above.

The supported `tsconfig.json` options are used for resolution and
transformation. These include path aliases, module and JSX settings, legacy
Expand Down
Loading
Loading