You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In composite projects with ttypescript, ts-node should call transformers with parameters defined on the tsconfig.json of the executed file instead of the original one
#1945
Open
aquilae opened this issue
Jan 27, 2023
· 0 comments
When building a composite project, typescript/ttypescript picks up the transformers defined on each nested project.
For example, with this structure:
root/
- tsconfig.json with transform A
- root.ts
- app/
- tsconfig.json with transform B
- app.ts
transform A will be applied to root.ts and transform B will be applied to app.ts.
In repro branch:
> npx ttsc -b
another transform subapp.ts with ../visitor
transform root.ts with ./visitor
Actual Behavior
ts-node currently reads transformers once from the tsconfig.json corresponding to the file you pass as an argument, and then applies the same transformer to all the files it encounters even when importing files under a different composite project.
root/
- tsconfig.json with transform A
- root.ts
- app/
- tsconfig.json with transform B
- app.ts
Running ts-node root.ts, transform A will be applied both to root.ts and app.ts
In repro branch:
> npx ts-node -C ttypescript root.ts
transform root.ts with ./visitor
transform subapp.ts with ./visitor
In practice, that completely breaks not only the ability to use different transformers for different projects, but also the support for relative path parameters to transformers.
Steps to reproduce the problem
Set up a composite TS project with different transformers for root and nested projects, notice the difference in transformer calls between ttsc -b and ts-node -C ttypescript ..
Search Terms
composite, transform, ttypescript
Expected Behavior
When building a composite project, typescript/ttypescript picks up the transformers defined on each nested project.
For example, with this structure:
transform A
will be applied toroot.ts
andtransform B
will be applied toapp.ts
.In repro branch:
Actual Behavior
ts-node
currently reads transformers once from thetsconfig.json
corresponding to the file you pass as an argument, and then applies the same transformer to all the files it encounters even when importing files under a different composite project.Running
ts-node root.ts
,transform A
will be applied both toroot.ts
andapp.ts
In repro branch:
In practice, that completely breaks not only the ability to use different transformers for different projects, but also the support for relative path parameters to transformers.
Steps to reproduce the problem
Set up a composite TS project with different transformers for root and nested projects, notice the difference in transformer calls between
ttsc -b
andts-node -C ttypescript .
.Minimal reproduction
Repro repo PR: TypeStrong/ts-node-repros#32
Specifications
The text was updated successfully, but these errors were encountered: