Timestamp Webpack Plugin

raw JSON →
0.2.3 verified Sat Apr 25 auth: no javascript deprecated

Emits a JSON file containing timestamps and formatted date fields for each Webpack build. Version 0.2.3, with last release in 2016. Provides customizable output path and filename, and a wide range of date/time format placeholders (date, yyyy, MMMM, timezone, etc.). No active maintenance; no updates for years. Alternatives include webpack-manifest-plugin or custom stats plugins.

error Error: Cannot find module 'timestamp-webpack-plugin'
cause Package not installed or installed in wrong directory.
fix
Run 'npm install --save-dev timestamp-webpack-plugin' from project root.
error TypeError: TimestampWebpackPlugin is not a constructor
cause Using ESM import incorrectly or wrong import syntax.
fix
Use 'const TimestampWebpackPlugin = require('timestamp-webpack-plugin');'
error Error: webpack.optimize.OccurrenceOrderPlugin is not a function
cause This plugin may conflict with older Webpack 1/2 patterns.
fix
Ensure Webpack version compatibility or remove plugin usage.
deprecated Package is unmaintained since 2016. May not work with modern Webpack 4/5.
fix Use a maintained alternative like webpack-manifest-plugin or webpack-subresource-integrity.
gotcha The 'path' option must be an absolute path; relative paths may not work correctly.
fix Use path.resolve(__dirname, 'my-folder') or an absolute path.
gotcha Output format 'MM' has leading space, not zero-padded. Example: " 06" for June.
fix Use 'MM' with leading zero if needed, or parse as integer.
npm install timestamp-webpack-plugin
yarn add timestamp-webpack-plugin
pnpm add timestamp-webpack-plugin

Shows basic Webpack configuration to output a timestamp.json file with build date and time.

const path = require('path');
const TimestampWebpackPlugin = require('timestamp-webpack-plugin');

module.exports = {
  entry: './src/index.js',
  output: { path: path.resolve(__dirname, 'dist'), filename: 'bundle.js' },
  plugins: [
    new TimestampWebpackPlugin({
      path: path.resolve(__dirname, 'dist'),
      filename: 'timestamp.json'
    })
  ]
};