Skip to content

fix(config): stop pointing users at the legacy void.json - #716

Merged
cpojer merged 1 commit into
voidzero-dev:mainfrom
morinokami:fix/legacy-void-json-references
Nov 4, 2026
Merged

cpojer merged 1 commit into
voidzero-dev:mainfrom
morinokami:fix/legacy-void-json-references

Conversation

@morinokami

Copy link
Copy Markdown
Contributor

Projects configure Void through void.config.ts, but several messages still name void.json, a file those projects don't have. For example, with sourceDir: 'src' and routes/ in both the project root and src/, vp dev stops with:

Error: sourceDir: void.json sets "sourceDir": "src", but convention path(s) also exist at the project root: routes. Move them under "src" or remove the root copy.

The same file name appears in:

  • sourceDir errors from readProjectPaths(), which framework adapters and many CLI commands use. readConfig() already named the right file.

  • The [cause] line printed under every void.config.ts validation error, because validateConfig() kept the error from before it replaced the file name:

    Error: config: "routing.isr" in void.config.ts must be a boolean.
    [cause]: Error: config: "routing.isr" in void.json must be a boolean.
    
  • VoidAssetRewriteError.

  • origin labels in the dev X-Void-Routing header and routing lint warnings. docs/guide/edge/rewrites.md already documents them as void.config.ts#routing.rewrites.

  • The file tree on the App Types docs page.

VoidAssetRewriteError also links to void.dev, which answers any path with a page that redirects to /lander. The docs are on void.cloud.

Fix

  • The sourceDir and conflict errors name the project's actual config file, so projects that still use void.json keep seeing void.json.
  • validateConfig() no longer attaches the original error as cause. Its message only differs by the placeholder file name.
  • VoidAssetRewriteError names void.config.ts and links to void.cloud.
  • origin labels read void.config.ts#routing.*.
  • The App Types file tree lists void.config.ts. The other docs already use it, so they do not change.

Not changed here

  • VoidAssetRewriteError and the origin labels aren't given the file name, so projects that still use void.json see void.config.ts there. void init and void deploy migrate those projects.
  • playground/kitchen-sink/pages/auth.vue still says void.json.

Tests

  • packages/void/test/unit/project-paths.test.ts: the sourceDir and conflict errors with void.config.ts, with void.json and with no config file.
  • packages/void/test/unit/config.test.ts: what an invalid void.config.ts prints, through util.inspect, which is what adds the [cause] line.
  • packages/void/test/unit/compile.test.ts: the file name and link in VoidAssetRewriteError.
  • origin expectations in five unit test files move to the new label.

These cases fail without this fix, except the void.json ones, which already passed.

Verification

  • vp test run: 774 files pass, 1 skipped (15,966 tests pass, 29 skipped).
  • vp run check: 33/33 pass.
  • By hand with vp dev on a copy of playground/ssr:
    • /docs/x through a routing.rewrites rule answers X-Void-Routing: rewrite[/docs/*] -> /api/hello (void.config.ts#routing.rewrites).
    • /old through a routing.redirects rule answers X-Void-Routing: redirect[/old] -> /api/hello 302 (void.config.ts#routing.redirects).
    • c.rewrite('/hero.png') in middleware answers 500 and logs VoidAssetRewriteError, which names void.config.ts and links to void.cloud.
    • A bad sourceDir, a bad routing.isr and a root conflict stop the server. With void.config.ts, the output has no void.json and no [cause] line. With void.json, the errors name void.json.
  • By hand with void prepare and a bad routing.isr in void.config.ts: the error names void.config.ts, and the output has no void.json.
  • vp run --filter ./docs build: the App Types page lists void.config.ts, and void.json is gone from it.
  • Not run by hand: a routing.fallbacks rule. The app's SSR entry answered first, and the unit tests check that label.

Projects configure Void through `void.config.ts`, but several places
still named `void.json`, a file those projects don't have:

- `sourceDir` errors from `readProjectPaths()`, which framework adapters
  and many CLI commands use (`readConfig()` already named the right file)
- the error for source conventions that exist in both the project root
  and `sourceDir`
- the `[cause]` line printed under every `void.config.ts` validation
  error, because `validateConfig()` kept the error from before it
  replaced the file name
- `VoidAssetRewriteError`
- `origin` labels in the dev `X-Void-Routing` header and routing lint
  warnings, which the rewrites guide already documents as
  `void.config.ts#routing.rewrites`
- the file tree on the App Types docs page

The `sourceDir` and conflict errors now name the project's actual config
file, so projects that still use `void.json` keep seeing the right name.
`validateConfig()` no longer attaches the original error as `cause`.
`VoidAssetRewriteError` and the `origin` labels aren't given the file
name, so they always say `void.config.ts`.

`VoidAssetRewriteError` also linked to `void.dev`, which doesn't host
the docs. It now links to `void.cloud`.

Tests: cover the `sourceDir` and conflict errors for both config files,
and what an invalid `void.config.ts` prints. The `void.config.ts` cases
fail on `main`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J8F8mb12HvQFWAKMEqYLme

@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.

Thanks for cleaning this up!

@cpojer
cpojer merged commit e3fb803 into voidzero-dev:main Nov 4, 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.

2 participants