vite-build-remote-deploy
v1.0.4
Published
Vite and webpack are packaged and automatically published to remote services.
Downloads
31
Maintainers
Readme
自动替换远程文件
vite和webpack,buildEnd时开始执行,上传指定文件到远程服务器的指定位置,远程地址不存在指定文件时自动创建。
vite示例:
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
import remoteDeploy from './rollup-plugin-remote-deploy.js'
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
vueDevTools(),
remoteDeploy({
host: '255.255.255.255',
port: 22,
username: 'root',
password: '*********',
targetFilePath: '/www/website/test',
localFilePath: './dist'
})
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
},
})webpack示例:
import path from'path'
import RemoteDeploy from './rollup-plugin-remote-deploy.js'
export default {
entry: './path/to/my/entry/file.js',
output: {
path: path.resolve('./', 'dist'),
filename: 'index.html',
},
plugins: [
RemoteDeploy({
host: '255.255.255.255',
port: 22,
username: 'root',
password: '*********',
targetFilePath: '/www/website/test',
localFilePath: './dist'
}),
],
};
