0.1.0 • Published 4 years ago

fis-http-push-webpack-plugin v0.1.0

Weekly downloads
7
License
ISC
Repository
github
Last release
4 years ago

fis-http-push-webpack-plugin

fis-http-push的webpack插件。

API

const WebpackHttpPushServerPlugin = require('fis-http-push-webpack-plugin');
new WebpackHttpPushServerPlugin({
    receiver: '', // fsr receiver url
    getDeployConfig: function(){}, // 处理文件需要推送到的目标路径
    shouldPush: true // 是否需要推送文件
})

EXAMPLE

const WebpackHttpPushServerPlugin = require('fis-http-push-webpack-plugin');
const deployConfig = {
    sitedataDir: '',
    destDir: ''
};
const outputDir = '';
const config = {
    plugins: [
        new WebpackHttpPushServerPlugin({
            shouldPush: true,
            receiver: 'xxx:8210',
            getDeployConfig(files) {
                return files.map(item => {
                    let replace = deployConfig.destDir;
                    if (item.indexOf('xxx') !== -1) {
                        replace = deployConfig.sitedataDir;
                    }
                    return {
                        source: item,
                        dest: item.replace(outputDir, replace)
                    };
                });
            }
        })
    ]
};
0.1.0

4 years ago