Dva: build之后如何部署到线上?

Created on 20 Dec 2016  ·  4Comments  ·  Source: dvajs/dva

dva项目build完之后产生dist文件夹,请问该怎么部署到线上去~

faq

Most helpful comment

@Lourenjie 有一种东西叫 CDN,而且现在很多 CDN 服务提供商,比如 七牛 的你可以这样:

const gulp = require('gulp');
const qiniu = require('gulp-qiniu');
const pkg = require('./package.json');
const join = require('path').join;

const config = {
  accessKey: 'xxx',
  secretKey: 'yyy',
  bucket: 'test-static',
  private: false
};
gulp.task('publish', function() {
  return gulp.src('dist/**')
    .pipe(qiniu(config, {
      dir: join('/', pkg.name, pkg.version)
    }));
});

All 4 comments

这问题就像 我给了你五百万,然后你问我 如何把钱花出去。。。。:smile:

推荐一篇
https://github.com/fouber/blog/issues/8#issuecomment-116253508
大公司里怎样开发和部署前端代码

@codering 看了之后受益颇多😭,我现在把我的服务在线上用npm start起在那呢,我是想换种方式起服务。。。。比如apache tomcat如何

@Lourenjie 有一种东西叫 CDN,而且现在很多 CDN 服务提供商,比如 七牛 的你可以这样:

const gulp = require('gulp');
const qiniu = require('gulp-qiniu');
const pkg = require('./package.json');
const join = require('path').join;

const config = {
  accessKey: 'xxx',
  secretKey: 'yyy',
  bucket: 'test-static',
  private: false
};
gulp.task('publish', function() {
  return gulp.src('dist/**')
    .pipe(qiniu(config, {
      dir: join('/', pkg.name, pkg.version)
    }));
});

你可以用express 设置一个静态文件,然后访问返回build后的文件,默认是index.html

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kpaxqin picture kpaxqin  ·  3Comments

zouyan532 picture zouyan532  ·  3Comments

itiwll picture itiwll  ·  4Comments

pengfeiWang picture pengfeiWang  ·  3Comments

sorrycc picture sorrycc  ·  3Comments