LinuxCommandLibrary

vue-serve

Serve a Vue app for development

TLDR

Serve a .js or .vue file in development mode with zero config

$ vue serve [filename]
copy

SYNOPSIS

vue-cli-service serve [options]

PARAMETERS

--open
    Opens the app in browser on server start.

--copy
    Copies the url to the clipboard on server start.

--https
    Serves over HTTPS. Note this requires configuring SSL in vue.config.js.

--port
    Port number to listen on. Defaults to 8080.

--host
    Specify host. Defaults to localhost.

--public
    Specify the public network URL for the HMR client.

--mode
    Specify compilation mode. Defaults to 'development'.

--skip-plugins
    Omit specified plugins from the compilation. Comma-separated.

DESCRIPTION

The vue-cli-service serve command is a development command provided by Vue CLI.
It builds your Vue application in development mode and serves it locally using a development server. This allows you to preview and test your application during development without needing to deploy it to a production environment. The command offers features like hot module replacement (HMR), which automatically updates the browser when you make changes to your code, greatly accelerating development. It handles tasks like compiling your JavaScript, CSS, and other assets. This command is essential for quickly iterating on Vue applications during the development process. The default development server listens on port 8080, but this can be customized.

CAVEATS

Requires a Vue CLI project to be initialized. If a vue.config.js file exists in the project root, the development server will respect configuration options defined within. If no `vue.config.js` file is present, default configurations will be used.

ENVIRONMENT VARIABLES

The vue-cli-service serve command uses the current environment to set environment variables available in the application code. For example, setting NODE_ENV=production will run Vue in production mode, affecting optimizations and console messages.

HISTORY

The vue-cli-service command is part of the Vue CLI (Command Line Interface), a full system for rapid Vue.js development. It emerged to streamline the creation and management of Vue projects. `vue-cli-service serve` became a core component, providing a quick and easy way to launch a development server for local testing and development. Its development reflects the evolution of web development workflows, emphasizing speed, efficiency, and a better developer experience.

SEE ALSO

vue(1)

Copied to clipboard