Registry / devops / webpack-asset-file-plugin

webpack-asset-file-plugin

JSON →
library1.0.2jsnpmunverified

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.

npm install webpack-asset-file-plugin
INSTALL
IMPORT
SIG · WEBPACK-ASSET-FILE
W
webpack-asset-file-plugin
devopsjavascriptv1.0.2
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.

AssetFilePlugin
✓ import AssetFilePlugin from 'webpack-asset-file-plugin'
✗ const AssetFilePlugin = require('webpack-asset-file-plugin').default
Default export; CommonJS require works but .default is not needed.
AssetFilePlugin
✓ const AssetFilePlugin = require('webpack-asset-file-plugin')
✗ const { AssetFilePlugin } = require('webpack-asset-file-plugin')
Named export does not exist; do not destructure.

Shows how to configure the plugin to output asset.json with compiled file details, excluding source maps.

const AssetFilePlugin = require('webpack-asset-file-plugin'); module.exports = { entry: './src/index.js', output: { path: path.resolve(__dirname, 'dist'), filename: 'bundle.js', }, plugins: [ new AssetFilePlugin({ filename: 'asset.json', excludeAssets: [/.*\.map$/], update: false, path: path.resolve(__dirname, 'dist'), }), ], };
Debug
Known issues
breakingPlugin is designed for webpack 4 only; may not work with webpack 5 due to removed hooks.
fix
Use an alternative like webpack-manifest-plugin for webpack 5.
affects: >=1.0.0
deprecatedThe package has not been updated since 2018; consider it in maintenance mode.
fix
Switch to actively maintained plugins like assets-webpack-plugin or webpack-manifest-plugin.
affects: >=1.0.0
gotchaThe `update` option set to false will overwrite the asset file on each build instead of merging.
fix
Set `update: true` to merge with existing asset file, if that behavior is desired.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read property 'compilation' of undefined
Plugin applied incorrectly, or not added to plugins array.
fix
Ensure plugin is instantiated and added to webpack's `plugins` array in config.
Error: [webpack-asset-file-plugin] options.filename is required
Missing `filename` option when instantiating plugin.
fix
Add `filename` option, e.g., `new AssetFilePlugin({ filename: 'assets.json' })`.
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies
webpackrequiredpeer dependency for webpack 4
Agent activity
11 hits · last 30 days
node
10
Resources
webpack-asset-file-plugin — npm install webpack-asset-file-plugin · libregistry