1. 程式人生 > >Vue Cli 3.0 之 vue-cli-service

Vue Cli 3.0 之 vue-cli-service

樣例

新建專案後,package.json 下的 script

 "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "test:unit": "vue-cli-service test:unit",
    "test:e2e": "vue-cli-service test:e2e",
  }

vue-cli-service serve

options 引數如下

Usage
: vue-cli-service serve [options] Options: --open open browser on server start --copy copy url to clipboard on server start --mode specify env mode (default: development) --host specify host (default: 0.0.0.0) --port specify port (default: 8080) --https use https (default: false
)

vue-cli-service build

options 引數如下

Usage: vue-cli-service build [options] [entry|pattern]

Options:

  --mode        specify env mode (default: production)
  --dest        specify output directory (default: dist)
  --modern      build app targeting modern browsers with auto fallback
  --target      app | lib | wc | wc-async (default: 
app)
--name name for lib or web-component mode (default: "name" in package.json or entry filename) --no-clean do not remove the dist directory before building the project --report generate report.html to help analyze bundle content --report-json generate report.json to help analyze bundle content --watch watch for changes

更多內容見