dividab / tsconfig-paths

Load node modules according to tsconfig paths, in run-time or via API.
MIT License
1.8k stars 100 forks source link

fixed resolve root directory #214

Open revinsys opened 2 years ago

revinsys commented 2 years ago

The bug was found in https://github.com/nestjs/nest/issues/9504. When using the Dockerfile and the root directory in it, the script crashed into an infinite loop

jonaskello commented 2 years ago

@revinsys The issue you are refering to seems to be using 3.9.0. Could you confirm this is a problem with tsconfig-paths 4.0.0? Also adding a test that shows the bug would be great.

revinsys commented 2 years ago

@jonaskello I checked it on version 4, the error persisted (originally it was version 3.14.1) I attached a code example Above, there is a separate repository branch and if you run it through the Dockerfile, this error will occur. The only thing is that initially I suggested the wrong solution. I tried to describe the problem in the test p.s. I don't know how to write tests, don't kick too much

revinsys commented 2 years ago

in particular, the function getPathsToTry returns for example //src/main.ts and other that does not match the path, and the resolver module tries to call again and again substituting at the beginning of the path / which leads to an infinite loop

jonaskello commented 2 years ago

@aleclarson Would you care to review this one?

n10000k commented 1 year ago

@jonaskello @aleclarson any updates on this?