1 Star 1 Fork 0

BarZu / JTaro-Tutorial

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
3-production.md 839 Bytes
一键复制 编辑 原始数据 按行查看 历史
BarZu 提交于 2017-05-17 15:20 . 更新打包上线文档

打包上线

修改环境

  • 切换到master主干
git checkout master
git merge develop
  • 修改api.js

编辑构建脚本

  • 创建pro/index.html
  • 创建build.js
// build.js
var jtaroBundle = require('jtaro-bundle')
var uglify = require('rollup-plugin-uglify')

jtaroBundle.bundle({
  rollupPlugins: [uglify()],
  origin: 'dev/index.html',  // 站点目录
  target: 'pro/index.html',  // 源目录
  copies: ['./assets/', './data/'],  // 目标文件
  sourceMap: true
})
  • 配置package.json的npm运行脚本命令
"scripts": {
  "dev": "cd dev && node jtaro-module/server.js",
  "pro": "cd pro && node ../dev/jtaro-module/server.js",
  "build": "node build.js"
}

打包运行

npm run build
npm run pro

测试没问题后将代码放到服务器上运行,收工。

1
https://gitee.com/chenjianlong/JTaro-Tutorial.git
git@gitee.com:chenjianlong/JTaro-Tutorial.git
chenjianlong
JTaro-Tutorial
JTaro-Tutorial
master

搜索帮助