Add variable to process.env.COMMIT
npm install --save-dev git-hash-webpack-plugin
const GitHashWebpackPlugin = require("git-hash-webpack-plugin");
module.exports = {
plugins: [
new GitHashWebpackPlugin()
]
}
// use
console.log(process.env.COMMIT) // commit id
options.len
- type: number
- default: 0
control hash length
options.webpack
- type: object
- default: null
if webpack version < 5 ; add webpack to option