webpack-ftp-uploader
v1.0.10
Published
webpack-ftp-uploader
Downloads
4
Readme
上传文件到ftp的webpack插件
vue项目打包后把打包的文件自动上传到ftp服务器
安装
npm install webpack-ftp-uploader -D
package.json 中增加部署命令
"deploy": "vue-cli-service build"
使用
const webpackFtpUploader = require("webpack-ftp-uploader");
module.exports = {
configureWebpack: (config) => {
if (process.env.NODE_ENV === "production") {
const argv = JSON.parse(process.env.npm_config_argv);
const cammand = argv.original[1]
cammand === 'deploy' && config.plugins.push(
new webpackFtpUploader({
host: "0.0.0.0",
user: "user",
password: "password",
port: 21,
localPath: 'dist/',
remotePath: '/test2/'
})
);
}
}
}