{"id":20032,"library":"filter-chunk-webpack-plugin","title":"filter-chunk-webpack-plugin","description":"A webpack plugin (v3.0.0) that filters and excludes assets from final output before emission, using flexible pattern rules (glob, RegExp, or custom functions). Supports include/exclude modes, debug logging, and pipelined rule processing. Requires Node >=20 and webpack ^5, ships TypeScript types. Differentiated by its rule-based pipeline and support for async filter functions. Releases are stable with irregular cadence.","status":"active","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/yeojz/filter-chunk-webpack-plugin","tags":["javascript","webpack","plugin","filter","chunk","assets","typescript"],"install":[{"cmd":"npm install filter-chunk-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add filter-chunk-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add filter-chunk-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin only works with webpack ^5.0.0","package":"webpack","optional":false}],"imports":[{"note":"ESM default export; CJS require returns the constructor directly (no .default).","wrong":"const FilterChunkWebpackPlugin = require('filter-chunk-webpack-plugin').default","symbol":"FilterChunkWebpackPlugin","correct":"import FilterChunkWebpackPlugin from 'filter-chunk-webpack-plugin'"},{"note":"CJS require works, but named destructuring fails because it's a default export.","wrong":"const { FilterChunkWebpackPlugin } = require('filter-chunk-webpack-plugin')","symbol":"FilterChunkWebpackPlugin","correct":"const FilterChunkWebpackPlugin = require('filter-chunk-webpack-plugin')"},{"note":"Type imports should use default import style for type-only usage.","wrong":"import { FilterChunkWebpackPlugin } from 'filter-chunk-webpack-plugin'","symbol":"FilterChunkWebpackPlugin (type)","correct":"import type FilterChunkWebpackPlugin from 'filter-chunk-webpack-plugin'"}],"quickstart":{"code":"import FilterChunkWebpackPlugin from 'filter-chunk-webpack-plugin';\n\nexport default {\n  // ... webpack config\n  plugins: [\n    new FilterChunkWebpackPlugin({\n      rules: [\n        {\n          patterns: '*.map', // remove all .map files\n        },\n      ],\n    }),\n  ],\n};","lang":"typescript","description":"Shows basic setup: import the plugin and add an instance to webpack plugins config to exclude .map files from output."},"warnings":[{"fix":"Ensure Node.js >=20 and webpack ^5 are installed.","message":"Version 3.0.0 requires Node >=20 and webpack ^5.0.0.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Update Node to >=8 or migrate to v3+ for Node >=20.","message":"Version 2.0.0 dropped Node v6 support and upgraded to webpack 4 compat.","severity":"breaking","affected_versions":">=2.0.0 <3.0.0"},{"fix":"Arrange rules in intended order, especially when combining exclude and include patterns across multiple rules.","message":"Rules are processed as a pipeline in exclude mode; order matters. Each rule filters from the remaining assets.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Ensure include rules are not contradictory; consider using exclude mode with negative patterns instead.","message":"In include mode, rules are combined with OR logic (union). Assets matching any rule are kept.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"","message":"No known deprecations; the plugin is stable with minimal updates.","severity":"deprecated","affected_versions":""}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use 'import FilterChunkWebpackPlugin from ...' (ESM) or 'const FilterChunkWebpackPlugin = require(...)' (CJS).","cause":"Using named import instead of default import or CJS destructuring incorrectly.","error":"TypeError: FilterChunkWebpackPlugin is not a constructor"},{"fix":"Run 'npm install filter-chunk-webpack-plugin --save-dev' and ensure Node >=20.","cause":"Package not installed or Node version incompatible (<20).","error":"Error: Cannot find module 'filter-chunk-webpack-plugin'"},{"fix":"Ensure options object has correct keys (mode, rules, debug) and rules follow the Rule schema.","cause":"Passing invalid options to the plugin constructor.","error":"ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema."},{"fix":"Pattern functions can be async; ensure they return a boolean or Promise<boolean>.","cause":"Using an async pattern function without awaiting the plugin's apply method or not returning a boolean.","error":"TypeError: Cannot read properties of undefined (reading 'length')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}