Webpack plugin can generate the latest git commit hash within html meta tag, which is very helpful when checking whether the deployment meets the expectations. It requires html-webpack-plugin.
npm install html-webpack-git-revision-plugin --save-dev
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackGitRevisionPlugin = require('html-webpack-git-revision-plugin');
module.exports = {
plugins: [
new HtmlPlugin(),
new HtmlWebpackGitRevisionPlugin()
]
}
Output:
<html>
<head>
<meta name="git-revision" content="0dc85118e7a1139d5dab943b7eee529c7be06d9c">
</head>
</html>