{"id":26643,"library":"webpack-asset-file-plugin","title":"webpack-asset-file-plugin","description":"A webpack plugin (v1.0.2) that generates asset files (e.g., JSON) containing the mapping of webpack output assets with their sizes and hash values. It is designed for webpack 4 and helps track compiled assets. The plugin writes an asset.json file to the output directory with details like filename, size, and hash. It is a niche tool compared to plugins like assets-webpack-plugin or webpack-manifest-plugin, which are more feature-rich and actively maintained. Release cadence is low (latest 2018), with no recent updates.","status":"maintenance","version":"1.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/hubcarl/webpack-asset-file-plugin","tags":["javascript","webpack","webpack 4","asset file html"],"install":[{"cmd":"npm install webpack-asset-file-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-asset-file-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-asset-file-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for webpack 4","package":"webpack","optional":false}],"imports":[{"note":"Default export; CommonJS require works but .default is not needed.","wrong":"const AssetFilePlugin = require('webpack-asset-file-plugin').default","symbol":"AssetFilePlugin","correct":"import AssetFilePlugin from 'webpack-asset-file-plugin'"},{"note":"Named export does not exist; do not destructure.","wrong":"const { AssetFilePlugin } = require('webpack-asset-file-plugin')","symbol":"AssetFilePlugin","correct":"const AssetFilePlugin = require('webpack-asset-file-plugin')"}],"quickstart":{"code":"const AssetFilePlugin = require('webpack-asset-file-plugin');\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 AssetFilePlugin({\n      filename: 'asset.json',\n      excludeAssets: [/.*\\.map$/],\n      update: false,\n      path: path.resolve(__dirname, 'dist'),\n    }),\n  ],\n};","lang":"javascript","description":"Shows how to configure the plugin to output asset.json with compiled file details, excluding source maps."},"warnings":[{"fix":"Use an alternative like webpack-manifest-plugin for webpack 5.","message":"Plugin is designed for webpack 4 only; may not work with webpack 5 due to removed hooks.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Switch to actively maintained plugins like assets-webpack-plugin or webpack-manifest-plugin.","message":"The package has not been updated since 2018; consider it in maintenance mode.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Set `update: true` to merge with existing asset file, if that behavior is desired.","message":"The `update` option set to false will overwrite the asset file on each build instead of merging.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure plugin is instantiated and added to webpack's `plugins` array in config.","cause":"Plugin applied incorrectly, or not added to plugins array.","error":"TypeError: Cannot read property 'compilation' of undefined"},{"fix":"Add `filename` option, e.g., `new AssetFilePlugin({ filename: 'assets.json' })`.","cause":"Missing `filename` option when instantiating plugin.","error":"Error: [webpack-asset-file-plugin] options.filename is required"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}