webpack-ftp-plugin
v0.0.6
Published
webpack ft deploy plugin
Downloads
8
Readme
webpack-ftp-plugin
Usage
Basic Usage
- 安装
$ npm i webpack-ftp-plugin
或是
$ yarn add --dev webpack-ftp-plugin
- 在项目根目录 需要添加个ftp验证文件 文件名:.ftppass 格式如下 :
{
"authKey": {
"username": "xx",
"password": "xxx"
},
"host": "x.x.x.x",
"port": "21"
}
- add the plugin to your webpack config as follows:
var WebpackFtpPlugin = require('webpack-ftp-plugin')
var webpackConfig = {
entry: 'index.js',
output: {
path: 'dist',
filename: 'index_bundle.js'
},
plugins: [new WebpackFtpPlugin({
remoteRoot: '/',
localRoot: __dirname,
deployPath: './build'
})]
}
注意事项
env支持,production生产环境才能deploy
process.env.NODE_ENV === 'production':
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
})