Open suin opened 5 months ago
"path": "./tsconfig.types.json"
Probably, this pattern (path to tsconfig.json directory) is unexpected. I believe the current implementation assumes that a directory is specified.
If path: “. /tsconfig.type.json"
is allowed, I think an implementation change is needed to fix this problem.
I ran into this issue as well, when using vite to create a new package. Vite's tsconfig structure looks like:
...
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
],
The
path
property of each reference in a TypeScript project can point to a directory containing atsconfig.json
file or directly to the config file itself (which may have any name).I am reporting an issue where
workspaces-to-typescript-project-references
does not work as expected in this context.Consider a monorepo with the following structure:
Focusing on the
a
package:packages/a/tsconfig.json
:This configuration file emits JavaScript code to the
lib
directory.packages/a/tsconfig.types.json
:This configuration file emits TypeScript declaration files to the
types
directory.The relationship between these two files is expressed using project references:
Therefore, running
tsc -b
in thea
package should compile bothtsconfig.json
and the referencedtsconfig.types.json
, emitting files to thelib
andtypes
directories, respectively.While specifying the config file in the
path
property may not be common, tools like moonrepo consider this approach as a valid use case, as described here.For the entire monorepo, the relationship between the config files is as follows:
For the complete code, please refer to this repository: https://github.com/suinplayground/monorepo-utils-1/tree/master/packages/%40monorepo-utils/workspaces-to-typescript-project-references/test/fixtures/yarn-workspaces-pointing-to-config-file
In this monorepo structure, I found that using
workspaces-to-typescript-project-references
results in references totsconfig.types.json
being removed:See the full error log here: https://github.com/suinplayground/monorepo-utils-1/actions/runs/9474724661/job/26104870429#step:6:60
The expected outcome is that references to
tsconfig.types.json
within the same package remain intact, while only inter-package references are managed.I would appreciate it if this issue could be resolved. Thank you for your attention to this matter.