[ Web Proxy ]
URL:
Viewing: https://vite.dev/guide/cli#dev-server [Back]  [Original]

Command Line Interface | Vite
Skip to content
Menu
Return to top
Sidebar Navigation
On this page
    ViteConf Logo [ViteConf Logo]

    Building Together

    ViteConf 2025

    View the replays

    Command Line Interface

    Dev server

    vite

    Start Vite dev server in the current directory. vite dev and vite serve are aliases for vite.

    Usage

    bash
    vite [root]

    Options

    Options
    --host [host]Specify hostname (string)
    --port <port>Specify port (number)
    --open [path]Open browser on startup (boolean | string)
    --corsEnable CORS (boolean)
    --strictPortExit if specified port is already in use (boolean)
    --forceForce the optimizer to ignore the cache and re-bundle (boolean)
    -c, --config <file>Use specified config file (string)
    --base <path>Public base path (default: /) (string)
    -l, --logLevel <level>info | warn | error | silent (string)
    --clearScreenAllow/disable clear screen when logging (boolean)
    --configLoader <loader>Use bundle to bundle the config with Rolldown, or runner (experimental) to process it on the fly, or native (experimental) to load using the native runtime (default: bundle)
    --profileStart built-in Node.js inspector (check Performance bottlenecks)
    -d, --debug [feat]Show debug logs (string | boolean)
    -f, --filter <filter>Filter debug logs (string)
    -m, --mode <mode>Set env mode (string)
    -h, --helpDisplay available CLI options
    -v, --versionDisplay version number

    Build

    vite build

    Build for production.

    Usage

    bash
    vite build [root]

    Options

    Options
    --target <target>Transpile target (default: "baseline-widely-available") (string)
    --outDir <dir>Output directory (default: dist) (string)
    --assetsDir <dir>Directory under outDir to place assets in (default: "assets") (string)
    --assetsInlineLimit <number>Static asset base64 inline threshold in bytes (default: 4096) (number)
    --ssr [entry]Build specified entry for server-side rendering (string)
    --sourcemap [output]Output source maps for build (default: false) (boolean | "inline" | "hidden")
    --minify [minifier]Enable/disable minification, or specify minifier to use (default: "oxc") (boolean | "oxc" | "terser" | "esbuild")
    --manifest [name]Emit build manifest json (boolean | string)
    --ssrManifest [name]Emit ssr manifest json (boolean | string)
    --emptyOutDirForce empty outDir when it's outside of root (boolean)
    -w, --watchRebuilds when modules have changed on disk (boolean)
    -c, --config <file>Use specified config file (string)
    --base <path>Public base path (default: /) (string)
    -l, --logLevel <level>Info | warn | error | silent (string)
    --clearScreenAllow/disable clear screen when logging (boolean)
    --configLoader <loader>Use bundle to bundle the config with Rolldown, or runner (experimental) to process it on the fly, or native (experimental) to load using the native runtime (default: bundle)
    --profileStart built-in Node.js inspector (check Performance bottlenecks)
    -d, --debug [feat]Show debug logs (string | boolean)
    -f, --filter <filter>Filter debug logs (string)
    -m, --mode <mode>Set env mode (string)
    -h, --helpDisplay available CLI options
    --appBuild all environments, same as builder: {} (boolean, experimental)

    Others

    vite optimize

    Pre-bundle dependencies.

    Deprecated: the pre-bundle process runs automatically and does not need to be called.

    Usage

    bash
    vite optimize [root]

    Options

    Options
    --forceForce the optimizer to ignore the cache and re-bundle (boolean)
    -c, --config <file>Use specified config file (string)
    --base <path>Public base path (default: /) (string)
    -l, --logLevel <level>Info | warn | error | silent (string)
    --clearScreenAllow/disable clear screen when logging (boolean)
    --configLoader <loader>Use bundle to bundle the config with Rolldown, or runner (experimental) to process it on the fly, or native (experimental) to load using the native runtime (default: bundle)
    -d, --debug [feat]Show debug logs (string | boolean)
    -f, --filter <filter>Filter debug logs (string)
    -m, --mode <mode>Set env mode (string)
    -h, --helpDisplay available CLI options

    vite preview

    Locally preview the production build. Do not use this as a production server as it's not designed for it.

    This command starts a server in the build directory (by default dist). Run vite build beforehand to ensure that the build directory is up-to-date. Depending on the project's configured appType, it makes use of certain middleware.

    Usage

    bash
    vite preview [root]

    Options

    Options
    --host [host]Specify hostname (string)
    --port <port>Specify port (number)
    --strictPortExit if specified port is already in use (boolean)
    --open [path]Open browser on startup (boolean | string)
    --outDir <dir>Output directory (default: dist) (string)
    -c, --config <file>Use specified config file (string)
    --base <path>Public base path (default: /) (string)
    -l, --logLevel <level>Info | warn | error | silent (string)
    --clearScreenAllow/disable clear screen when logging (boolean)
    --configLoader <loader>Use bundle to bundle the config with Rolldown, or runner (experimental) to process it on the fly, or native (experimental) to load using the native runtime (default: bundle)
    -d, --debug [feat]Show debug logs (string | boolean)
    -f, --filter <filter>Filter debug logs (string)
    -m, --mode <mode>Set env mode (string)
    -h, --helpDisplay available CLI options
    Pager

    Web Proxy Viewer  |  New URL  |  Original Page