Skip to content

Add VitePress support to framework auto-port-injection#276

Open
alistair3149 wants to merge 1 commit intovercel-labs:mainfrom
alistair3149:add-vitepress-framework
Open

Add VitePress support to framework auto-port-injection#276
alistair3149 wants to merge 1 commit intovercel-labs:mainfrom
alistair3149:add-vitepress-framework

Conversation

@alistair3149
Copy link
Copy Markdown

@alistair3149 alistair3149 commented May 1, 2026

Summary

Adds vitepress to the FRAMEWORKS_NEEDING_PORT map so portless auto-injects --port, --strictPort, and --host for VitePress dev servers, matching the existing behavior for plain Vite.

Why

VitePress's CLI ignores the PORT env var and binds to its own default (5173), so the random port portless allocates goes unused and proxy requests return 404. Concretely, in a VitePress project:

$ portless run pnpm exec vitepress dev
PORT=4530 HOST=127.0.0.1 ... pnpm exec vitepress dev
  vitepress v2.0.0-alpha.17
  Local:   http://localhost:5173/      # ignored PORT, bound 5173
$ curl https://myapp.localhost/         # 404 with x-portless: 1

VitePress wraps Vite's dev server. In vitepress/dist/node/chunk-*.js:

async function createServer(root, serverOptions = {}, ...) {
  const { base, ...server } = serverOptions;
  return createServer$1({ ..., server, ... });
}

Parsed argv flows through to Vite's server config unchanged, so --port, --strictPort, and --host all behave the same as they do for plain Vite. SvelteKit-style indirection isn't needed here because vitepress is the actual CLI basename; findFrameworkBasename matches it directly.

Changes

  • packages/portless/src/cli-utils.ts: add vitepress: { strictPort: true } to the framework map (one line)
  • packages/portless/src/cli-utils.test.ts: add a unit test mirroring the vp test
  • packages/portless/src/cli.ts: list VitePress in the --help framework enumeration
  • README.md and skills/portless/SKILL.md: list VitePress alongside Vite/VitePlus per AGENTS.md docs-update rules

Test plan

  • pnpm -C packages/portless exec vitest run src/cli-utils.test.ts passes (102 tests)
  • New injects ... for vitepress command test asserts the exact arg array
  • pnpm exec prettier --check passes on all modified files
  • Verified empirically with vitepress@2.0.0-alpha.17: without this change, portless allocates a port that VitePress ignores and the proxy 404s; with this change applied locally, the named URL serves the dev server end-to-end

VitePress's CLI ignores the PORT env var and binds to its own default
(5173), so portless's allocated port goes unused and the proxy returns
404. VitePress wraps Vite's dev server (createServer destructures the
parsed argv and spreads it into Vite's server config), so --port,
--strictPort, and --host all flow through to Vite untouched.

Adds vitepress: { strictPort: true } to FRAMEWORKS_NEEDING_PORT,
matching the existing vite and vp entries. SvelteKit-style indirection
is not needed because vitepress is invoked as its own CLI command,
which is what findFrameworkBasename matches.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 1, 2026

@alistair3149 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant