Closed bitschubse closed 2 weeks ago
You probably want to pin to v4.2.3 for now. If someone gets me a StackBlitz reproduction, I'll look into it.
Unfortunately, it is not so easy to reduce our project to a easy StackBlitz reproduction. Therefore I had hoped for a first idea which changes in the new versions could lead to such a problem. But I will try my best to create a StackBlitz reproduction.
The content of your tsconfig.json
files might hint at the problem.
The only change in 4.3 is upgrading tsconfck
(the package used for finding and parsing tsconfig files) by a major version.
Have the same issue, simple reproducible case with 2 tsconfigs, most likely tsconfck.parse
goes into a loop, in my case.
tsconfig.json
{
"references": [{ "path": "./tsconfig.test.json" }],
}
tsconfig.test.json
{
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true
}
}
Hello @aleclarson, I'm facing the same issue with Analogjs & Angular.
Here is a reproduction:
npm i
npm run test:app
With 4.3.0
I'm facing this issue:
> nx run analog-nx:test
failed to load config from E:\Git\analog-nx\apps\analog-nx\vite.config.ts
> NX No "exports" main defined in E:\Git\analog-nx\node_modules\tsconfck\package.json
With 4.3.1
nothing happen
Downgrading to 4.2.3
works for now.
Seems like you have a similar structure as in my case, where a tsconfig.base
references another tsconfig
that extends it. Most likely this is the issue.
this seems to happen if you have an indirect circles. tsconfck detects circles in "extends", but a circle thats between references and extends can stay undetected and then it can lock up with 2 Promises waiting for each other if you try to parse a 2 of them at the same time.
This is bound to happen here https://github.com/aleclarson/vite-tsconfig-paths/blob/ca4e2aa7f3be36facbce0305cc145f9d5f9693d1/src/index.ts#L96 if all files in question are named tsconfig.json
but can also happen if many files are processed at the same time. I'll have to see how to guard against this in tsconfck.
A workaround in get-tsconfig-paths could be to serialize the parse of found configs for the time being, affected users could try to not have references point at files that they also extend.
circle:
/src/tsconfig.json # extends ../tsconfig.json
tsconfig.json # references src/tsconfig.json
no circle:
/src/tsconfig.json # extends ../tsconfig.base.json
tsconfig.json # references src/tsconfig.json , nothing but references in it
tsconfig.base.json # all the base config values
the latter seems to be the pattern used by typescript itself: https://github.com/microsoft/TypeScript/blob/main/src/tsconfig.json
If anyone wants to implement a workaround in this plugin, PR welcome.
Otherwise, use the config solution recommended by Dominik above, and wait for a fix to be added to tsconfck
(a package used by this plugin for tsconfig parsing).
@aleclarson: Problem seems to be fixed with 4.3.2 without any changes on our side. Should I close the issue?
After updating to version 4.3.1 (same problem for 4.3.0), our build hangs directly after the build command call. There are no log messages or errors.
Using the DEBUG variable we get only the following output. Build hangs after that.
Used vite dependency versions:
Does anyone have any idea what the cause is or how we can get to the bottom of the problem?