nuxt.js打包上线流程

  1. 项目完毕后运行 npm run build
  2. 把 static nuxt.config package.json .nuxt 拷贝到服务器
  3. 执行npm i
  4. 执行npm run start

后台:(egg)

  1. 把egg文件夹拖到服务器
  2. npm i
  3. npm run dev

nuxt.js打包上线流程_第1张图片

package.json配置:

{
  "name": "ksproduct",
  "version": "1.0.0",
  "description": "My wondrous Nuxt.js project",
  "author": "hometown",
  "private": true,
  "config": {
    "nuxt": {
      "host": "0.0.0.0",
      "port": 3000
    }
  },
  "scripts": {
    "dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server",
    "build": "nuxt build",
    "start": "nuxt start",
    "generate": "nuxt generate"
  },
  "dependencies": {
    "cross-env": "^5.2.0",
    "element-ui": "^2.4.11",
    "koa": "^2.6.2",
    "mavon-editor": "^2.7.6",
    "nuxt": "^2.0.0"
  },
  "devDependencies": {
    "@nuxtjs/axios": "^5.6.0",
    "axios": "^0.19.0",
    "nodemon": "^1.18.9"
  }
}

你可能感兴趣的:(nuxt.js打包上线流程)