An explicit tsconfig can only be selected through environment variables: init_resolver reads TS_NODE_PROJECT, then OXC_TSCONFIG_PATH (src/lib.rs#L1515-L1516).
That is awkward for a tool that wraps the loader and lets its user pick a tsconfig. Vite+ runs scripts with vpx --tsconfig <path> script.ts:
- Setting
OXC_TSCONFIG_PATH for the loader also sets it for the user's script and for every process the script spawns. A nested oxnode, or another loader, then inherits a tsconfig chosen for the outer script.
- A
TS_NODE_PROJECT that the user exported for ts-node takes precedence over OXC_TSCONFIG_PATH, so the wrapper would have to remove it from the environment, which changes what the user's own child processes see.
Proposal
Accept the path through the API, so a loader can pass it without touching process.env. For example:
- an option on the
OxcTransformer constructor and on createResolve/load (e.g. { tsconfig?: string }); or
- a function such as
setTsconfigPath(path) that must run before the first transform or resolve, since the resolver and tsconfig source live in a process-wide OnceLock.
The environment variables would keep working as they do now.
Today Vite+ patches the variable name to its own VP_SCRIPT_TSCONFIG.
An explicit tsconfig can only be selected through environment variables:
init_resolverreadsTS_NODE_PROJECT, thenOXC_TSCONFIG_PATH(src/lib.rs#L1515-L1516).That is awkward for a tool that wraps the loader and lets its user pick a tsconfig. Vite+ runs scripts with
vpx --tsconfig <path> script.ts:OXC_TSCONFIG_PATHfor the loader also sets it for the user's script and for every process the script spawns. A nestedoxnode, or another loader, then inherits a tsconfig chosen for the outer script.TS_NODE_PROJECTthat the user exported for ts-node takes precedence overOXC_TSCONFIG_PATH, so the wrapper would have to remove it from the environment, which changes what the user's own child processes see.Proposal
Accept the path through the API, so a loader can pass it without touching
process.env. For example:OxcTransformerconstructor and oncreateResolve/load(e.g.{ tsconfig?: string }); orsetTsconfigPath(path)that must run before the first transform or resolve, since the resolver and tsconfig source live in a process-wideOnceLock.The environment variables would keep working as they do now.
Today Vite+ patches the variable name to its own
VP_SCRIPT_TSCONFIG.