Fix #1880: Show git commit of bundled app

This commit is contained in:
Martin Fournier
2021-12-16 15:23:27 -05:00
parent e16fba2418
commit e8e2760c73
5 changed files with 21 additions and 4 deletions
+10
View File
@@ -42,6 +42,13 @@ module.exports = (env, argv) => {
};
}
// Get the current commit hash to inject into the app
// https://stackoverflow.com/a/38401256
const commitHash = require('child_process')
.execSync('git rev-parse --short HEAD')
.toString()
.trim();
return {
plugins: [
new webpack.DefinePlugin({
@@ -105,6 +112,9 @@ module.exports = (env, argv) => {
},
},
}),
new webpack.DefinePlugin({
__COMMIT_HASH__: JSON.stringify(commitHash)
}),
// In dev mode, use a faster method of create sourcemaps
// while keeping lines/columns accurate
isDevServer &&