Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于按版本打包 #449

Closed
zuiidea opened this issue Jul 30, 2017 · 7 comments
Closed

关于按版本打包 #449

zuiidea opened this issue Jul 30, 2017 · 7 comments

Comments

@zuiidea
Copy link
Owner

zuiidea commented Jul 30, 2017

npm run build:new

依据package.json中的version字段打包到相应目录,如:当前"version":"4.3.0",将会

  • 更改package.json中的version字段为4.3.1
  • 静态文件copy到dist根目录,版本相关文件生成到dist/4.3.1目录
  • dist/index.html将会引用dist/4.3.1/index.js,所以ngnix配置的时候只需指向dist/index.html
  • 细心的观众会发现dist/4.3.1/index.html,这样做为了在打包4.3.2后发现有错误,还想快速切换至4.3.1,
    只需将dist/4.3.1/index.html覆盖至dist/index.html

version.js做的事

  • 新增版本号,注意只会增加以“v1.v2.v3”格式的v3的值,如需自定义,自行修改即可
  • 清理最近5个版本号以前的文件
@lilyAlucy
Copy link

坐等楼主更新

@namoweixiao
Copy link

坐等更新

@951565664
Copy link

951565664 commented Sep 30, 2017

@zuiidea 您好,使用verson功能报错,我是用脚手架新生产的一个项目,然后引入了您写的verson.js,依赖包js-beauty也对应安装了,在roadhog.js做了如下配置,

const path = require('path')
const { version } = require('./package.json')

export default {
  "entry": 'src/index.js',

  "publicPath": `/${version}/`,
  "outputPath": `./dist/${version}`,
  // 接口代理示例

  "env": {
    "development": {
      "extraBabelPlugins": [
        "dva-hmr",
        "transform-runtime"
      ]
    },
    "production": {
      "extraBabelPlugins": [
        "transform-runtime"
      ]
    }
  }
}

2

但是即使报错,dist能够按照版本分开了,不知道是什么原因。

@superlbr
Copy link
Collaborator

superlbr commented Jun 1, 2018

@951565664 目录不要有中文

@superlbr
Copy link
Collaborator

superlbr commented Jun 1, 2018

目前master分支已不支持按版本打包,最后支持的版本应该是4.3.9

@harekuer
Copy link

是为何取消了按版本打包呢

@superlbr
Copy link
Collaborator

@harekuer 貌似是从roadhog换成umi的结果

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants