{"id":20031,"library":"filemanager-webpack-plugin","title":"FileManager Webpack Plugin","description":"Webpack plugin to copy, move, delete, archive (.zip/.tar/.tar.gz), and create directories before and after builds. Current stable version is 8.x (latest published as 10.0.1 but v7+ had alpha releases with breaking changes; v8 introduced new options). Requires Node >=22.14.0 and webpack ^5.0.0. Ships TypeScript definitions. Key differentiator: supports multiple file operations in a single plugin with glob patterns and flat copy options. Alternatives like copy-webpack-plugin only handle copying.","status":"active","version":"10.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/gregnb/filemanager-webpack-plugin","tags":["javascript","filemanager-plugin","webpack","webpack-archive-plugin","webpack-copy-plugin","typescript"],"install":[{"cmd":"npm install filemanager-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add filemanager-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add filemanager-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency, plugin architecture requires webpack","package":"webpack","optional":false}],"imports":[{"note":"ESM default export since v8. For CJS, use require but ensure default export handling.","wrong":"const FileManagerPlugin = require('filemanager-webpack-plugin')","symbol":"FileManagerPlugin","correct":"import FileManagerPlugin from 'filemanager-webpack-plugin'"},{"note":"In CJS, the default export is under .default property due to ESM interop.","wrong":"const FileManagerPlugin = require('filemanager-webpack-plugin')","symbol":"FileManagerPlugin","correct":"const FileManagerPlugin = require('filemanager-webpack-plugin').default"},{"note":"Type-only import available for TypeScript users. The package ships types.","wrong":"","symbol":"FileManagerPluginOptions","correct":"import type { FileManagerPluginOptions } from 'filemanager-webpack-plugin'"}],"quickstart":{"code":"const path = require('path');\nconst FileManagerPlugin = require('filemanager-webpack-plugin').default;\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  plugins: [\n    new FileManagerPlugin({\n      events: {\n        onEnd: {\n          copy: [\n            { source: './src/assets', destination: './dist/assets' },\n          ],\n          archive: [\n            { source: './dist', destination: './release.zip' },\n          ],\n        },\n      },\n    }),\n  ],\n};","lang":"javascript","description":"Sets up the plugin to copy assets folder to dist and create a zip archive after build."},"warnings":[{"fix":"Add `options: { flat: true }` to your copy actions if you need flattened output.","message":"Upgrading from v6 to v7: copy with glob now maintains directory structure by default. Use `options.flat: true` to flatten.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Explicitly set `options.flat` to `true` or `false` to control directory structure preservation.","message":"v7 removed the `cpy` dependency, which may affect copy behavior for glob patterns without `flat` option.","severity":"breaking","affected_versions":"7.0.0"},{"fix":"Add `new webpack.WatchIgnorePlugin({ paths: [/copied-directory/] })` to your webpack config.","message":"onStart might fire twice in watch mode. Use WatchIgnorePlugin to ignore output directories.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Remove `runTasksInSeries` from options.","message":"The `runTasksInSeries` option is deprecated as of v8. Tasks are now always run in series.","severity":"deprecated","affected_versions":">=8.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install filemanager-webpack-plugin --save-dev (ensure webpack is installed)","cause":"Package not installed or peer dependency webpack not installed.","error":"Cannot find module 'filemanager-webpack-plugin'"},{"fix":"Use `const FileManagerPlugin = require('filemanager-webpack-plugin').default;`","cause":"Using wrong import method (CJS with default export).","error":"TypeError: FileManagerPlugin is not a constructor"},{"fix":"Use format: 'tar' with options: { gzip: true } instead.","cause":"Using 'tar.gz' as format, but only 'tar' and 'zip' are valid.","error":"Error: Options validation: archive[0].format: 'tar.gz' is not recognized"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}