webpack-ftp-plugin

0.0.6 • Public • Published

webpack-ftp-plugin

实例

Usage

Basic Usage

  1. 安装
     $  npm i webpack-ftp-plugin

或是

    $  yarn  add --dev  webpack-ftp-plugin
  1. 在项目根目录 需要添加个ftp验证文件 文件名:.ftppass 格式如下 :
    {
        "authKey": {
            "username": "xx",
            "password": "xxx"
        },
        "host": "x.x.x.x",
        "port": "21"
    }
  1. 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')
})

License

MIT

/webpack-ftp-plugin/

    Package Sidebar

    Install

    npm i webpack-ftp-plugin

    Weekly Downloads

    3

    Version

    0.0.6

    License

    ISC

    Last publish

    Collaborators

    • charlie_lau