Vue CLI 3 start cli Service Parameters

Use the command

In a Vue CLI project, @ vue / cli-service command called vue-cli-service installed. You can vue-cli-service, or to ./node_modules/.bin/vue-cli-service access this command from the terminal in npm scripts.

This is your using the default preset items package.json:


	{
	  "scripts": {
	    "serve": "vue-cli-service serve",
	    "build": "vue-cli-service build"
	  }
	}
	

You can call these script by npm or Yarn:


	npm run serve
	# OR
	yarn serve
	

If you can use npx (the latest version of npm should have been built), it can also directly call this command:


	npx vue-cli-service serve
	

vue-cli-service serve


	用法:vue-cli-service serve [options] [entry]
	
	选项:
	
	  --open    在服务器启动时打开浏览器
	  --copy    在服务器启动时将 URL 复制到剪切版
	  --mode    指定环境模式 (默认值:development)
	  --host    指定 host (默认值:0.0.0.0)
	  --port    指定 port (默认值:8080)
	  --https   使用 https (默认值:false)
	  

vue-cli-service serveCommand will start a development server (based on WebPACK-dev-Server ) and comes with thermal overload module (Hot-Module-Replacement) out of the box.

In addition to the command-line parameters, you can also use the vue.config.jsinside - devserver fields to configure the development server.

Command line arguments [entry]will be designated as the only entrance, not an additional extra entrance. Try to use the [entry]cover config.pagesof entrythe may lead to errors.

vue-cli-service build


	用法:vue-cli-service build [options] [entry|pattern]
	
	选项:
	
	  --mode        指定环境模式 (默认值:production)
	  --dest        指定输出目录 (默认值:dist)
	  --modern      面向现代浏览器带自动回退地构建应用
	  --target      app | lib | wc | wc-async (默认值:app)
	  --name        库或 Web Components 模式下的名字 (默认值:package.json 中的 "name" 字段或入口文件名)
	  --no-clean    在构建项目之前不清除目标目录
	  --report      生成 report.html 以帮助分析包内容
	  --report-json 生成 report.json 以帮助分析包内容
	  --watch       监听文件变化
	  

vue-cli-service buildWill dist/produce a package can be used in a production environment directory, compression with JS / CSS / HTML, and for better caching and do automatic vendor chunk splitting. Within its chunk manifest will be linked in HTML.

Here are some useful commands parameters:

--modernUse modern model building applications, deliver native support for the ES2015 code for the modern browser and older browsers compatible generate a package to automatically rolled back.

--targetAllows you to any component of the project to build a library or in a manner Web Components components. For more details please refer to the build target .

--reportAnd --report-jsonwill be constructed in accordance with the statistical report is generated, it will help you analyze the module's included in the package size.

vue-cli-service inspect


	用法:vue-cli-service inspect [options] [...paths]
	
	选项:
	
	  --mode    指定环境模式 (默认值:development)
	  

You can use vue-cli-service inspectto review a Vue CLI project webpack config.

See all available commands

Some CLI commands will inject an additional plug-in to vue-cli-service. E.g. @ vue / cli-plugin-eslint injects vue-cli-service lint command. You can run the following command to view all of the command injection:


	npx vue-cli-service help
	

You can also learn this option is available for each command:


	npx vue-cli-service help [command]
	
Published 59 original articles · won praise 78 · views 20000 +

Guess you like

Origin blog.csdn.net/PrisonersDilemma/article/details/104795922