将编译完成的前端文件放置发布项目中
开始, 你需要安装 webpack-jpush-publish-plugin
:
$ npm install webpack-jpush-publish-plugin --save-dev
然后添加 webpack
配置. 如下:
webpack.config.js
const jpushPublish = require('webpack-jpush-publish-plugin');
module.exports = {
plugins: [
new jpushPublish({
gitLab: 'https://gitlab.jpushoa.com/titan/titan-front/titan-rbac-front-publish.git',
env: 'test', //分支名称
version: (new Date).getTime(), //打包版本
dir: 'publish/www/', //移动复制打包文件至XXX
filter: /^.*$/ //需要移动复制的文件
}),
],
};
ℹ️
webpack-jpush-publish-plugin
插件主要用于极光前端代码打包后复制搬运到发布项目目录.
The plugin's signature:
webpack.config.js
module.exports = {
plugins: [new CopyPlugin(patterns, options)],
};
Name | Type | Default | Description |
---|---|---|---|
gitLab |
{String} |
undefined |
发布部署项目的仓库地址 |
env |
{String} |
compiler.options.output |
发布环境-对应发布项目分支. |
version |
{String} |
options.context || compiler.options.context |
打包版本 |
dir |
{String} |
undefined |
发布项目存放编译文件目录XXX |
filter |
{RegExp} |
undefined |
需要移动复制至发布项目里的文件 |