{"id":26990,"library":"filemanager-plugin","title":"filemanager-plugin","description":"A file management plugin for webpack, rollup, and Vite that supports delete, copy, move, rename, zip/unzip operations before and after builds. Current stable version is 2.9.0. It provides two event-driven APIs: a simple 'events' pattern for common build lifecycle hooks (start/end) and a more flexible 'customHooks' pattern that allows binding to arbitrary compiler hooks (e.g., webpack's compile, rollup's generateBundle). Supports .zip, .tar, .tar.gz archives. Unlike similar plugins (e.g., copy-webpack-plugin, webpack-archive-plugin), filemanager-plugin bundles multiple file operations in one plugin, includes rollup and Vite support. Release cadence is irregular; last update was in 2023. Requires Node >= 14, webpack >= 4.","status":"active","version":"2.9.0","language":"javascript","source_language":"en","source_url":"https://github.com/xianweics/filemanager-plugin","tags":["javascript","webpack","rollup","vite","file manager","nodejs","glob"],"install":[{"cmd":"npm install filemanager-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add filemanager-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add filemanager-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for webpack hooks integration; plugin works without it if only rollup/vite.","package":"webpack","optional":true},{"reason":"Required for rollup integration.","package":"rollup","optional":true},{"reason":"Required for Vite integration.","package":"vite","optional":true}],"imports":[{"note":"Package uses CommonJS; named export WebpackFilemanager for webpack. Rollup uses RollupFilemanager. No default export.","wrong":"import FileManagerPlugin from 'filemanager-plugin';","symbol":"FileManagerPlugin","correct":"const { WebpackFilemanager } = require('filemanager-plugin');"},{"note":"CommonJS named export for rollup.","wrong":"import RollupFilemanager from 'filemanager-plugin';","symbol":"RollupFilemanager","correct":"const { RollupFilemanager } = require('filemanager-plugin');"},{"note":"CommonJS named export for Vite. Does not exist in README but listed in package exports; verify version 2.9.0.","wrong":"import { ViteFilemanager } from 'filemanager-plugin';","symbol":"ViteFilemanager","correct":"const { ViteFilemanager } = require('filemanager-plugin');"}],"quickstart":{"code":"const { WebpackFilemanager } = require('filemanager-plugin');\n\nmodule.exports = {\n  plugins: [\n    new WebpackFilemanager({\n      events: {\n        start: {\n          delete: {\n            items: ['./dist']\n          }\n        },\n        end: {\n          zip: {\n            items: [\n              { source: './src/demo0.zip', destination: './dest/demo0', type: 'zip' }\n            ]\n          }\n        }\n      }\n    })\n  ]\n};","lang":"javascript","description":"Configures filemanager-plugin in webpack to delete the dist folder before build and zip a file after build."},"warnings":[{"fix":"Use only one of events or customHooks per plugin instance.","message":"When customHooks is set, events are ignored entirely.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Always specify type: 'zip' or 'tar' explicitly.","message":"The 'type' field in zip items may be deprecated; some users report unzip operations failing without explicit type.","severity":"deprecated","affected_versions":">=2.5.0"},{"fix":"Use absolute paths or paths relative to process.cwd().","message":"File paths are relative to the project root, not the config file location.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use require() or enable interop in bundler (e.g., allowSyntheticDefaultImports).","message":"The package uses CommonJS and does not provide ESM exports; cannot be imported with import syntax in default bundler setups.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use const { WebpackFilemanager } = require('filemanager-plugin');","cause":"Using default import instead of named import.","error":"TypeError: WebpackFilemanager is not a constructor"},{"fix":"Run npm install filemanager-plugin --save-dev and ensure it is in node_modules.","cause":"Package not installed or path incorrect.","error":"Error: Cannot find module 'filemanager-plugin'"},{"fix":"const { WebpackFilemanager } = require('filemanager-plugin');","cause":"Forgetting to destructure the named export.","error":"WebpackFilemanager is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}