webpack-deploy-plugin 0.0.10
Install from the command line:
Learn more about npm packages
$ npm install @planjs/webpack-deploy-plugin@0.0.10
Install via package.json:
"@planjs/webpack-deploy-plugin": "0.0.10"
About this version
The plugin currently only supports
rsync
andoss-upload-tool
. If it is rsync, you need to confirm whether the environment supports rsync.
Using npm:
npm install @planjs/webpack-deploy-plugin --save-dev
webpack.Stats
All output content will be uploaded to the server, or oss.
webpack.config.js
const WebpackDeployPlugin = require('@planjs/webpack-deploy-plugin')
module.exports = {
plugins: [
new WebpackDeployPlugin({
targets: {
oss: {
type: 'oss',
// oss deploy folder
dest: '/app/test1/',
patterns: ['**', '!**.js.map'],
OSSUploadOptions: {
type: 'COS',
COSOptions: {
SecretId: 'xxx',
SecretKey: 'xxx'
},
uploadParams: {
Bucket: 'xxx',
Region: 'xxx'
}
}
},
rsync: {
type: 'rsync',
patterns: ['**', '!**.js.map'],
dest: '[email protected]:/www/deploy folder'
}
},
// The key of the `targets` used
env: 'oss'
})
]
};
Upload configuration collection.
Type: Record<any, TargetItem> | TargetItem
If there are multiple upload configurations, it will be switched according to this as the key.
Type: string
Type: rsync | oss
How to upload files.
Upload to server folder.
type oss
folder default''
type rsync
server connection string[email protected]:/www/deploy folder
Type: string
Type: string | string[]
multimatch
The paths to match against will be uploaded.
Rsync args.
Type: { args: string[][] }
eg:
['bwlimit', 10]
rsync
Detailed reference node-rsync
Type: object
Detailed reference oss-upload-tool
Type: (stats: Stats) => void | Promise<void>
Upload complete event.
By default, window will use 8191 as the longest length, leave 100 for other parameters, and if the remaining length is too long, it will become multiple rsync commands.
If it still fails, it may be an environment problem, change the cutting rules through the variable MAX_COMMAND_LINE_LIMIT
.
MIT © fupengl