Skip to content

Conversation

@marwinhormiz
Copy link
Contributor

Description

Currently, when the @payload-config path alias is missing from tsconfig.json, the package fails with a cryptic error when running commands such as generate:types or generate:importmap:

node:path:1464
    validateString(path, 'path');
    ^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined

This happens because configPath becomes undefined when the path alias is missing, which later causes a path resolution error. This PR improves error handling to provide clearer feedback.

Changes

Added explicit error handling when @payload-config path alias is missing
Added descriptive error message to guide users on how to fix the issue
Added fallback to default configuration path (./src/payload.config.ts)

Related Issue

Closes #9796

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError when @payload-config path alias is missing from tsconfig.json

1 participant