Registry / devops / filemanager-plugin

filemanager-plugin

JSON →
library2.9.0jsnpmunverified

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.

npm install filemanager-plugin
INSTALL
IMPORT
SIG · FILEMANAGER-PLUGIN
F
filemanager-plugin
devopsjavascriptv2.9.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FileManagerPlugin
const { WebpackFilemanager } = require('filemanager-plugin');
import FileManagerPlugin from 'filemanager-plugin';
Package uses CommonJS; named export WebpackFilemanager for webpack. Rollup uses RollupFilemanager. No default export.
RollupFilemanager
const { RollupFilemanager } = require('filemanager-plugin');
import RollupFilemanager from 'filemanager-plugin';
CommonJS named export for rollup.
ViteFilemanager
const { ViteFilemanager } = require('filemanager-plugin');
import { ViteFilemanager } from 'filemanager-plugin';
CommonJS named export for Vite. Does not exist in README but listed in package exports; verify version 2.9.0.

Configures filemanager-plugin in webpack to delete the dist folder before build and zip a file after build.

const { WebpackFilemanager } = require('filemanager-plugin'); module.exports = { plugins: [ new WebpackFilemanager({ events: { start: { delete: { items: ['./dist'] } }, end: { zip: { items: [ { source: './src/demo0.zip', destination: './dest/demo0', type: 'zip' } ] } } } }) ] };
Debug
Known issues
gotchaWhen customHooks is set, events are ignored entirely.
fix
Use only one of events or customHooks per plugin instance.
affects: >=2.0.0
deprecatedThe 'type' field in zip items may be deprecated; some users report unzip operations failing without explicit type.
fix
Always specify type: 'zip' or 'tar' explicitly.
affects: >=2.5.0
gotchaFile paths are relative to the project root, not the config file location.
fix
Use absolute paths or paths relative to process.cwd().
affects: >=1.0.0
gotchaThe package uses CommonJS and does not provide ESM exports; cannot be imported with import syntax in default bundler setups.
fix
Use require() or enable interop in bundler (e.g., allowSyntheticDefaultImports).
affects: >=2.0.0
Errors
Common errors & fixes
TypeError: WebpackFilemanager is not a constructor
Using default import instead of named import.
fix
Use const { WebpackFilemanager } = require('filemanager-plugin');
Error: Cannot find module 'filemanager-plugin'
Package not installed or path incorrect.
fix
Run npm install filemanager-plugin --save-dev and ensure it is in node_modules.
WebpackFilemanager is not defined
Forgetting to destructure the named export.
fix
const { WebpackFilemanager } = require('filemanager-plugin');
Upgrade
Version history
2.9.0latest on npm
Audit
Dependencies
webpackoptionalUsed for webpack hooks integration; plugin works without it if only rollup/vite.
rollupoptionalRequired for rollup integration.
viteoptionalRequired for Vite integration.
Agent activity
2 hits · last 30 days
node
2
Resources
filemanager-plugin — npm install filemanager-plugin · libregistry