- 将webpack构建产物推送到服务器指定目录
- 首先需要在服务器上启动一个服务,用来接收和放置文件
- 下载
npm i webpack-cslupload-plugin -D
webpack.config.js
const UploadPlugin = require("webpack-cslupload-plugin");
const path = require("path");
module.exports = {
...
plugins: [
new UploadPlugin({
baseUrl: "存放目录,如/home/",
url: "服务地址,如http://xxx:8888/",
}),
],
};