【发布时间】:2019-06-12 09:44:26
【问题描述】:
我使用 Vue 已经有一段时间了,但我刚刚开始使用 CLI,我有点困惑。
我安装了@vue/cli,如果我在命令行中输入vue,我会得到:
Usage: vue <command> [options]
Options:
-V, --version output the version number
-h, --help output usage information
Commands:
create [options] <app-name> create a new project powered by vue-cli-service
add [options] <plugin> [pluginOptions] install a plugin and invoke its generator in an already created project
invoke [options] <plugin> [pluginOptions] invoke the generator of a plugin in an already created project
inspect [options] [paths...] inspect the webpack config in a project with vue-cli-service
serve [options] [entry] serve a .js or .vue file in development mode with zero config
build [options] [entry] build a .js or .vue file in production mode with zero config
ui [options] start and open the vue-cli ui
init [options] <template> <app-name> generate a project from a remote template (legacy API, requires @vue/cli-init)
config [options] [value] inspect and modify the config
upgrade [semverLevel] upgrade vue cli service / plugins (default semverLevel: minor)
info print debugging information about your environment
Run vue <command> --help for detailed usage of given command.
我使用vue 创建了一个项目,但由于某种我不记得的原因,我需要安装@vue/cli-service-global。
然而,在那之后,我注意到:
'vue-cli-service' is not recognized as an internal or external command
那是因为我必须安装@vue/cli-service。现在,当我在命令行中输入vue-cli-service 时,我得到:
Usage: vue-cli-service <command> [options]
Commands:
serve start development server
build build for production
inspect inspect internal webpack config
run vue-cli-service help [command] for usage of a specific command.
显然,我可以使用这两种 CLI 工具进行构建、服务和检查。我的问题是 - 它们之间有什么区别? @vue/cli 和 @vue/cli-service 的自述文件都只有一个指向 this page 的链接,其中没有给出该问题的答案。
我可以用一个我不能用另一个做什么?两者都需要吗?
【问题讨论】: