Upload the packaged resources to the server based on node-ssh.
$ npm install --save-dev upload-server-webpack-plugin
In webpack.prod.config.js
:
import UploadServerPlugin from "upload-server-webpack-plugin";
export default {
// This script will be ran after building
...
plugins: [
...
new UploadServerPlugin({
host: "xxx.xxx.x.xx", // server host ip
port: '22', // server host port
username: "root",
password: "123456",
remotePath: "/home/",
}),
...
],
...