Repository navigation
Conversation
getTSConfigPaths() used compilerOptions.rootDir/outDir as-is. With a
relative value like "./", findUpSync never reached the filesystem root
(path.dirname('.') === '.', path.parse('.').root === ''), so any CLI
command that calls findConfig (e.g. generate:types) hung at 100% CPU.
- resolve rootDir/outDir against the tsconfig directory, like baseUrl
- resolve dir in findUp/findUpSync so a relative dir always terminates
Fixes payloadcms#18324
Author
|
Hi @denolfe, @AlessioGr 👋 This fixes #18324: I also confirmed the bug still exists on Thanks! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
payloadCLI commands that locate the config (e.g.generate:types) hang forever at 100% CPU whentsconfig.jsonhas a relativecompilerOptions.rootDir(like"./") and no@payload-configpath /PAYLOAD_CONFIG_PATH.Why?
getTSConfigPaths()usedrootDir/outDiras-is, unlikebaseUrland@payload-config, which are resolved against the tsconfig directory.findConfig()then callsfindUpSync({ dir: './' }), and sincepath.parse('./').root === ''andpath.dirname('.') === '.',dirnever equalsroot, so thewhile (true)loop never exits.Repro: https://github.com/bbkysf/payload-rootdir-hang
How?
config/find.ts: resolverootDirandoutDirrelative to the tsconfig directory (matching TypeScript's semantics and howbaseUrlis already handled).utilities/findUp.ts:path.resolve(dir)at the start offindUpSync/findUp, so a relativedirfrom any caller always terminates at the filesystem root.find.spec.ts,findUp.spec.ts). Without the fix, these tests hang; with it they pass. Allpackages/payloadunit tests pass.The same change applies cleanly to
main(the files are identical there).Fixes #18324