Skip to content

Hint at tsconfig path aliases when void.config.ts fails to load - #801

Merged
cpojer merged 1 commit into
voidzero-dev:mainfrom
karthickeyan-dev:fix/config-alias-hint
Nov 12, 2026
Merged

cpojer merged 1 commit into
voidzero-dev:mainfrom
karthickeyan-dev:fix/config-alias-hint

Conversation

@karthickeyan-dev

@karthickeyan-dev karthickeyan-dev commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Closes #800.

void.config.ts is loaded with jiti, which only aliases void/config, so an import through tsconfig paths failed with an error that reads like a missing package. env.ts already detects this case and adds a hint; the config loader now does the same.

Changes

  • Moved extractFailedSpecifier() and looksLikeAlias() from host/load-user-env.ts into a new host/alias-hint.ts, with an aliasHint(err, file) helper that both loaders use.
  • extractFailedSpecifier() now also accepts MODULE_NOT_FOUND, the code jiti's require-based loading reports.
  • loadVoidConfig() appends the hint when the failed specifier looks like an alias:
    config: Could not load void.config.ts: Cannot find module '@/lib/theme'
    Require stack:
    - /path/to/app/void.config.ts
    
    Hint: '@/lib/theme' looks like a tsconfig path alias. void.config.ts does not resolve tsconfig "paths" — use a relative import (e.g. "./shared/...") instead.
    
  • docs/reference/config.md now says to use relative imports or package names in void.config.ts, matching the env.ts note in the env vars guide.

The env.ts hint wording changes slightly ("env.ts does not resolve tsconfig "paths"" instead of "env.ts is loaded directly by Node and does not resolve…") so both files share one message.

Tests

  • New packages/void/test/unit/config-loader.test.ts: a relative import loads, an @/… import gets the hint, and a missing scoped package (@scope/pkg) doesn't.
  • vp test run (full suite: 793 files, 16674 tests passed) and vp run check pass.

🤖 Generated with Claude Code

voidzero-dev#800.

Move the alias detection from the env.ts loader into a shared host helper,
accept jiti's MODULE_NOT_FOUND code, and document that void.config.ts only
supports relative imports and package names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cpojer cpojer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@cpojer
cpojer merged commit a16d286 into voidzero-dev:main Nov 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Say that void.config.ts can't use tsconfig path aliases, and hint at it like env.ts does

2 participants