Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
webpack-auto-inject-version
Advanced tools
Adds version from package.json into every single file as top comment block.
$ npm install webpack-auto-inject-version --save-dev
Auto Inject Version (AIV) can:
[AIV]{version}[/AIV]
[AIV]{version}[/AIV]
Please take a look into demo/
folder.
AIV can inject version number for all your bundle files (css,js,html).
// [AIV] Build version: 1.0.10
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
Example html:
<!-- [AIV] Build version: 1.0.10 -->
<!DOCTYPE html>
<html lang="en">
In webpack.conf.js ( or any name of webpack conf file )
var WebpackAutoInject = require('webpack-auto-inject-version').default;
module.exports = {
plugins: [
new WebpackAutoInject({
// options
// example:
components: {
AutoIncreaseVersion: false
}
})
]
}
Auto increase package.json number.
This option requires extra argument to be sent to webpack build.
It happens before anything else to make sure that your new version is injected into your files.
Arguments: --env.major --env.minor --env.patch
Example for package.json run type, npm run start => ( 1.2.10 to 2.0.0 )
"version" : "1.2.10",
"scripts": {
"start": "webpack --env.major"
}
Default: true
Inject version number into your file
Version will replace the <{version}> tag.
<span>My awesome project | [AIV]{version}[/AIV]</span>
var version = '[AIV]{version}[/AIV]';
Default: true
This will inject your version as a comment into any css,js,html file.
Default: true
Demo has been created to simplify the testing of the webpack-plugin, if you would like to work on this webpack plugin you should:
FAQs
Webpack plugin for auto inject version from package.json
The npm package webpack-auto-inject-version receives a total of 4,294 weekly downloads. As such, webpack-auto-inject-version popularity was classified as popular.
We found that webpack-auto-inject-version demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.