适用于umi3.x,umi2.x请使用umi-plugin-upload
# or yarn
$ npm install
$ npm run build --watch
$ npm run start
Configure in .umirc.js
,
export default {
plugins: [
['umi-plugin-upload-new'],
],
upload: {
host: 'xxx',
username: 'xxx',
password: 'xxxx',
sourcePath: 'dist/',
targetPath: '/home/test'
}
}
如果没有配置密码,则在上传时命令行会给出交互提示输入密码
export default {
plugins: [
['umi-plugin-upload']
],
upload: {
host: 'xxxx',
username: 'xxxx',
password: 'xxxx',
sourcePath: 'dist/',
targetPath: '/home/ubuntu/test'
}
}
// 将dist目录上传到/home/ubuntu下,并命名为test
export default {
plugins: [
['umi-plugin-upload']
],
upload: {
host: 'xxxx',
username: 'xxxx',
password: 'xxxx',
sourcePath: 'dist/umi.js',
targetPath: '/home/ubuntu/test.js'
}
}
// 将umi.js上传到/home/ubuntu下并重命名为test.js
export default {
plugins: [
['umi-plugin-upload']
],
upload: {
host: 'xxxx',
username: 'xxxx',
password: 'xxxx',
sourcePath: 'dist/*.js',
targetPath: '/home/ubuntu/test'
}
}
// 将dist下的所有js文件上传到/home/ubuntu/test目录下,glob模式请确保targetPath代表的目录在远程是存在的
TODO
MIT