New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

webpack-incremental-deploy-plugin

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-incremental-deploy-plugin

Webpack 增量部署插件,用于在生产环境构建时过滤未变更的文件,实现增量部署

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Webpack Incremental Deploy Plugin

一个用于 Webpack 的增量部署插件,可以在生产环境构建时过滤未变更的文件,实现增量部署,减少部署包大小和部署时间。

特性

  • 🚀 增量部署:只部署变更的文件,减少部署包大小
  • 🌐 网络支持:支持从网络 URL 读取基准文件
  • 📁 目录过滤:只对指定目录下的文件进行过滤
  • 📋 文件清单:自动生成包含所有输出文件的清单
  • 性能优化:预计算路径,提高处理速度
  • 🔧 RSBuild 兼容:支持 RSBuild/Rspack 项目
  • 🛡️ 错误处理:完善的错误处理和超时机制

安装

npm install webpack-incremental-deploy-plugin

使用方法

Webpack 项目

const IncrementalDeployPlugin = require('webpack-incremental-deploy-plugin');

module.exports = {
  plugins: [
    new IncrementalDeployPlugin({
      appName: 'your-app-name',
      baseUrl: 'https://your-domain.com',
      debug: true,
      generateFileList: true,
    })
  ]
};

RSBuild 项目

// rsbuild.config.ts
import IncrementalDeployPlugin from 'webpack-incremental-deploy-plugin';

export default {
  tools: {
    rspack: {
      plugins: [
        new IncrementalDeployPlugin({
          appName: 'your-app-name',
          baseUrl: 'https://your-domain.com',
          debug: true,
        })
      ],
    },
  },
};

配置选项

选项类型默认值描述
appNamestring''应用名称,会自动拼接为完整的基准文件URL
baseUrlstring''基准文件基础URL
fileListNamestring'file_list.txt'文件清单文件名
extensionsstring[]['.js', '.css', '.png']要过滤的文件扩展名
allowedDirectoriesstring[]['dist/img', 'dist/css', 'dist/js', 'dist/fonts']允许过滤的目录列表
outputPrefixstring'dist/'输出目录前缀
generateFileListbooleantrue是否生成文件清单
debugbooleanfalse是否启用调试日志
timeoutnumber3000网络请求超时时间(毫秒)

工作原理

  • 读取基准文件:从网络或本地读取基准文件列表
  • 文件对比:将当前构建的文件与基准文件进行对比
  • 过滤文件:移除未变更的文件,只保留变更的文件
  • 生成清单:生成包含所有输出文件的清单文件

URL 生成规则

基准文件 URL 的生成规则为:

${baseUrl}/${appName}/${fileListName}

例如:

https://your-domain.com/your-app-name/file_list.txt

错误处理

  • 网络请求失败时会输出错误信息并跳过文件过滤
  • 超时时间默认为 3 秒,可通过 timeout 选项配置
  • 所有错误都不会中断构建过程

许可证

MIT

贡献

欢迎提交 Issue 和 Pull Request!

Keywords

webpack

FAQs

Package last updated on 02 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts