Module execution environments attached to the Vite server.
An alias to server.environments.client.hot.
If you want to interact with all environments, loop over server.environments.
native Node http server instance will be null in middleware mode
A connect app instance.
Module graph that tracks the import relationships, url to file mapping and hmr state.
Rollup plugin container that can run plugin hooks on a given file
The resolved urls Vite prints on the CLI (URL-encoded). Returns null
in middleware mode or if the server is not listening on any port.
Calling await server.waitForRequestsIdle(id) will wait until all static imports
are processed. If called from a load or transform plugin hook, the id needs to be
passed as a parameter to avoid deadlocks. Calling this function after the first
static imports section of the module graph has been processed will resolve immediately.
Chokidar watcher instance. If config.server.watch is set to null,
it will not watch any files and calling add or unwatch will have no effect.
https://github.com/paulmillr/chokidar/tree/3.6.0#api
WebSocket server with send(payload) method
Stop the server.
Start the server.
Optionalport: numberOptionalisRestart: booleanOpen browser
Print server urls
Triggers HMR for a module in the module graph. You can use the server.moduleGraph
API to retrieve the module to be reloaded. If hmr is false, this is a no-op.
Restart the server.
OptionalforceOptimize: booleanforce the optimizer to re-bundle, same as --force cli flag
Returns a fixed version of the given stack
Transform module code into SSR format.
OptionaloriginalCode: stringApply vite built-in HTML transforms and any plugin HTML transforms.
OptionaloriginalUrl: stringProgrammatically resolve, load and transform a URL and get the result without going through the http request pipeline.
Optionaloptions: TransformOptionsSame as transformRequest but only warm up the URLs so the next request
will already be cached. The function will never throw as it handles and
reports errors internally.
Optionaloptions: TransformOptions
The resolved vite config object