webpack-ftp-plugin2
v0.0.3
Published
webpack ft deploy plugin
Downloads
8
Readme
webpack-ftp-plugin2
说明
该插件基于原创修改以满足开发需求,https://github.com/CharlieLau/webpack-ftp-plugin
Usage
Basic Usage
- 安装
$ npm i webpack-ftp-plugin2
或是
$ yarn add --dev webpack-ftp-plugin2
- add the plugin to your webpack config as follows:
var WebpackFtpPlugin = require('webpack-ftp-plugin2')
var webpackConfig = {
entry: 'index.js',
output: {
path: 'dist',
filename: 'index_bundle.js'
},
plugins: [new WebpackFtpPlugin({
ftp: {
"authKey": {
"username": "xx", // 用户名
"password": "xxx" // 密码
},
"host": "x.x.x.x", // ip
"port": "21" // 端口
},
remoteRoot: '/', // 远程ftp路径
localRoot: __dirname, // 本地路径根目录
deployPath: './build' // 基于本地路径根目录的相对路径
})]
}
注意事项
env支持,production生产环境才能deploy
process.env.NODE_ENV === 'production':
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
})