Description
What problem does this feature solve?
We should unify the logic of loading Rslib config file / package.json / tsconfig.json in javascript-api and CLI to avoid passing root param.
When we read tsconfig.json
from config.source.tsconfigPath
when we compose configs, it may be different from Rsbuild internal logic:
-
In DTS plugin ,we get
tsconfig.json
fromconfig.source.tsconfigPath
that be processed by Rsbuild which is an absolute path with joinroot
config in Rsbuild config orprocess.cwd()
-
When we loading tsconfig.json in compose configs, we get raw value of
config.source.tsconfigPath
field which maybe a relative path without concating base dir. The root we now use is fromroot
options in Rslib CLI or function params inbuild
javascript api.
We can pass absolute tsconfigPath to Rsbuild with concat our root base to preventing users config root
in Rsbuild config to influence the tsconfigPath value in DTS.
We should handle root well in these situations:
- cli load related config file
- no config mode (to be designed)
- cli params of config [Feature]: Support specify more config of
build
command #454 (to be designed) - js api load related config file (to be designed)