Registry / devops / webpack-auto-inject-version

webpack-auto-inject-version

JSON →
library1.2.2jsnpmunverified

Webpack plugin that automatically injects version from package.json into bundle files as a comment block, replaces custom tags (e.g., [AIV]{version}[/AIV]) in HTML/CSS/JS, and optionally auto-increments the package version via webpack env flags (--env.major, --env.minor, --env.patch). Current stable version 1.2.2. Simple configuration with sensible defaults, all features enabled out of the box. Supports customization of comment format, date format, and tag regex. Limited maintenance; no major updates since 2019.

npm install webpack-auto-inject-version
INSTALL
IMPORT
SIG · WEBPACK-AUTO-INJEC
W
webpack-auto-inject-version
devopsjavascriptv1.2.2
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WebpackAutoInject
✓ const WebpackAutoInject = require('webpack-auto-inject-version');
✗ import WebpackAutoInject from 'webpack-auto-inject-version';
This package does not provide ESM exports; use CommonJS require.

Configures webpack-auto-inject-version plugin in webpack.config.js with all options, injecting version as comment and replacing [AIV] tags.

// webpack.config.js const WebpackAutoInject = require('webpack-auto-inject-version'); module.exports = { // ... webpack config plugins: [ new WebpackAutoInject({ SHORT: 'CUSTOM', SILENT: false, PACKAGE_JSON_PATH: './package.json', PACKAGE_JSON_INDENT: 4, components: { AutoIncreaseVersion: false, InjectAsComment: true, InjectByTag: true }, componentsOptions: { InjectAsComment: { tag: 'Version: {version} - {date}', dateFormat: 'h:MM:ss TT', multiLineCommentType: false }, InjectByTag: { fileRegex: /\.+/, AIVTagRegexp: /(\[AIV])(([a-zA-Z{} ,:;!()_@"'\\\/])+)(\[\/AIV])/g, dateFormat: 'h:MM:ss TT' } } }) ] };
Debug
Known issues
gotchaAutoIncreaseVersion in watch mode will increment version on every rebuild if runInWatchMode is true (default false).
fix
Set runInWatchMode to false (default) to avoid unintended version bumps during development.
affects: >=0.0.0
deprecatedPackage has not been updated since 2019; may not work with latest webpack 5+ without adjustments.
fix
Consider migrating to alternative plugins like 'webpack-version-plugin' or use webpack.DefinePlugin with process.env.npm_package_version.
affects: >=1.2.2
gotchaPACKAGE_JSON_INDENT default is 2, but example shows 4; mismatched indent may cause version file reformatting.
fix
Set PACKAGE_JSON_INDENT to match your package.json indent (usually 2) to avoid unwanted changes.
affects: >=0.0.0
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'webpack-auto-inject-version'
Missing npm install or incorrect import path.
fix
Run 'npm install webpack-auto-inject-version --save-dev' and use require('webpack-auto-inject-version').
Upgrade
Version history
1.2.2latest on npm
Audit
Dependencies
webpackrequiredPeer dependency for webpack plugin
Agent activity
22 hits · last 30 days
node
18
OpenAI (training)
1
Resources
webpack-auto-inject-version — npm install webpack-auto-inject-version · libregistry