node >= 10, npm >= 4
$ npm install
$ npm run serve
./src/main.ts
const axios = Axios.create({
baseURL: process.env.NODE_ENV === 'production' && process.env.VUE_APP_TITLE !== 'experiment' ? 'http://build' : 'http://debug'
})
// http://build 为构建环境
// http://debug 开发环境
// ./vue.config.js
module.exports = {
baseUrl: process.env.NODE_ENV === 'production' ? 'http://127.0.0.1' : './',
assetsDir: './',
devServer: {
disableHostCheck: true
}
}
// 127.0.0.1
更换./cdn.js里面的key secret,设置文件url 为七牛服务器
// ./dist/*上传到服务器
$ node cdn
$ npm run build
// 如果需要上传到七牛cdn
$ npm run build && node cdn