Skip to content

docs: document server.preTransformRequests - #23230

Open
wahidrizka wants to merge 1 commit into
vitejs:mainfrom
wahidrizka:docs/server-pretransformrequests
Open

docs: document server.preTransformRequests#23230
wahidrizka wants to merge 1 commit into
vitejs:mainfrom
wahidrizka:docs/server-pretransformrequests

Conversation

@wahidrizka

Copy link
Copy Markdown

What

server.preTransformRequests is part of the public ServerOptions type and carries its own JSDoc and @default, but grep -rn "preTransformRequests" docs/ returns nothing. The only way to discover it today is reading packages/vite/src/node/server/index.ts.

It is also the odd one out next to server.warmup, which sits in the same interface, controls closely related behaviour, and is documented.

Changes

Adds a ## server.preTransformRequests section to docs/config/server-options.md, placed between server.warmup and server.watch. It covers:

  • the type and default, taken from the existing JSDoc on ServerOptions.preTransformRequests
  • what it does: importAnalysis calls environment.warmupRequest() for every static local import of a module it transforms, so those modules are ready before the browser asks for them
  • that dynamic imports are not pre-transformed
  • that server.open's early-crawl optimisation depends on it (server/index.ts guards that path with if (server.config.server.preTransformRequests))

What I checked

The one internal link I used, #server-open, already resolves: ## server.open exists in the same file and docs/config/preview-options.md links to it the same way. The code sample matches the formatting of the server.warmup sample directly above it.

I did not run pnpm run test-docs locally, since it needs a full monorepo install and build to be meaningful. The change is markdown only, with no new anchors and no new external links.

The option is part of the public ServerOptions type and carries a
@default, but it was never mentioned anywhere in the docs, so the only
way to find it was reading the source.

Placed next to server.warmup since both control the same pre-transform
behaviour.
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