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.
Common errors
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.
Warnings
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.
Install
npm install timestamp-webpack-plugin yarn add timestamp-webpack-plugin pnpm add timestamp-webpack-plugin Imports
- TimestampWebpackPlugin wrong
import TimestampWebpackPlugin from 'timestamp-webpack-plugin';correctconst TimestampWebpackPlugin = require('timestamp-webpack-plugin'); - TimestampWebpackPlugin (ESM) wrong
const { TimestampWebpackPlugin } = require('timestamp-webpack-plugin');correctimport TimestampWebpackPlugin from 'timestamp-webpack-plugin'; - Configuration
module.exports = { plugins: [new TimestampWebpackPlugin({ path: './', filename: 'build.json' })] };
Quickstart
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'
})
]
};