webpack-yam-plugin

raw JSON →
1.0.1 verified Sat Apr 25 auth: no javascript maintenance

A Webpack plugin that generates a JSON manifest file mapping entry points to their output asset paths, with paths relative to a configurable root directory. Version 1.0.1 is the latest stable release; the project appears to be in maintenance mode with no recent updates since 2016. Key differentiators: relative path normalization for easier deployment, distinct status fields (building/built/errors) to reflect build state, and integration with a companion Python manifest reader.

error Error: Cannot find module 'webpack-yam-plugin'
cause Missing npm install or incorrect module path.
fix
Run 'npm install webpack-yam-plugin' and ensure node_modules contains the package.
error TypeError: WebpackManifestPlugin is not a constructor
cause Wrong import style causing undefined reference.
fix
Use correct CommonJS import: 'const WebpackManifestPlugin = require('webpack-yam-plugin');'
error Error: The 'manifestPath' option must be an absolute path.
cause Passed a relative path to manifestPath.
fix
Use path.resolve() to convert relative path to absolute.
error Error: Invalid status value 'building' in manifest.
cause Reading manifest before webpack compilation completes.
fix
Wait for compilation finished hook or check manifest.status === 'built'.
deprecated Package has not been updated since 2016; may not work with Webpack 5 or later.
fix Use a maintained alternative like webpack-manifest-plugin or assets-webpack-plugin.
breaking Plugin requires absolute paths for manifestPath and outputRoot; relative paths will cause errors.
fix Always pass absolute paths using path.resolve().
gotcha Manifest schema includes a 'building' status; reading the manifest before build completes may return incomplete data.
fix Check manifest.status before using files; use 'built' status as ready indicator.
gotcha The plugin writes to manifestPath on each compilation; multiple compilations can overwrite the file.
fix Ensure manifestPath is unique per compiler instance or use hook-based alternatives.
npm install webpack-yam-plugin
yarn add webpack-yam-plugin
pnpm add webpack-yam-plugin

Shows basic Webpack configuration with webpack-yam-plugin, including absolute manifestPath and outputRoot.

const path = require('path');
const webpack = require('webpack');
const WebpackManifestPlugin = require('webpack-yam-plugin');

const compiler = webpack({
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: '[name].[chunkhash].js'
  },
  plugins: [
    new WebpackManifestPlugin({
      manifestPath: path.resolve(__dirname, 'dist', 'manifest.json'),
      outputRoot: path.resolve(__dirname, 'dist')
    })
  ]
});

compiler.run((err, stats) => {
  if (err) { console.error(err); return; }
  console.log('Build complete. Manifest written to:', stats.compilation.assets['manifest.json'] ? 'yes' : 'no');
});