https://cli.vuejs.org/zh/guide/
Introduction
caveat
This document corresponds @vue/cli
3.x version. The old version of vue-cli
the document please move here .
Vue CLI is a complete system based on Vue.js rapid development, provides:
- By
@vue/cli
building interactive project scaffolding. - By
@vue/cli
+@vue/cli-service-global
Quick Start Configuration prototyping zero. - A run-time-dependent (
@vue/cli-service
), which rely on:- Can be upgraded;
- Based webpack constructed, and with a reasonable default configuration;
- It can be configured via the configuration file in the project;
- It can be extended via plug-ins.
- A rich collection of official plug-in, integrated front-end ecological best tool.
- A fully graphical user interface for creating and managing Vue.js projects.
Vue CLI is committed to standardize basic tools Vue Ecology. It ensures that the various building tools can be based on the default configuration intelligence can smooth convergence, so you can focus on writing applications, without having to spend several days to issue tangled configuration. At the same time, it also provides the flexibility to adjust the configuration for each tool, without having to eject.
# The system components
Vue CLI has several independent parts - if you see our source code , you will find this warehouse simultaneously manage multiple publications of the pack alone.
#CLI
The CLI ( @vue/cli
) is a global installation package npm, provided in the terminal vue
command. It can vue create
create a new project scaffolding quick, direct or by vue serve
constructing a prototype new ideas. You can also pass vue ui
through a graphical interface to manage all your projects. In the next chapter we will gradually in-depth presentation of the guide.
# CLI service
CLI Service ( @vue/cli-service
) is a development environment dependent. It is a npm package locally installed at each @vue/cli
project you create.
CLI service is built on webpack and webpack-dev-server above. It contains:
- CLI loaded core services other plug-ins;
- A vast majority of applications optimized for webpack internal configuration;
- Internal project
vue-cli-service
command, provideserve
,build
andinspect
command.
If you are familiar with create-react-app , it @vue/cli-service
actually is roughly equivalent to react-scripts
, although not the same feature set.
CLI service chapters cover its specific use.
# CLI plug-in
CLI is an optional plug-in functionality to your Vue project npm package, such as Babel / TypeScript translation, ESLint integration, unit testing and end-to-end testing. Name Vue CLI plug-in @vue/cli-plugin-
(built-in plug-in) or vue-cli-plugin-
beginning (community plug-ins), very easy to use.
When you run the project within the vue-cli-service
command, it will automatically parse and load package.json
all plug-ins listed in the CLI.
Plug-ins can be created as part of the process of the project, or at a later stage to join the project. They can also be classified into a set of preset reusable. We will plug and preset depth discussion section.
installation
About the old version
Vue CLI package by the name vue-cli
changed @vue/cli
. If you have an older version of the global installed vue-cli
(1.x or 2.x), you need to pass npm uninstall vue-cli -g
or yarn global remove vue-cli
uninstall it.
Node Version
Vue CLI requires Node.js version 8.9 or later (recommended 8.11.0+). You can use nvm or nvm-windows to manage multiple Node versions on the same computer.
You may use any of a command to install the new package:
npm install -g @vue/cli
# OR
yarn global add @vue/cli
Once installed, you can access the command line vue
command. You can simply run vue
to see if it exhibits a help for all available commands, to verify that it installed successfully.
You can also use this command to check whether the correct version (3.x):
vue --version