I\'m using react/es6/webpack. I want to show the date of the build and git hash somewhere in my app. What\'s the best approach?
You can use webpack's DefinePlugin:
// get git info from command line
let commitHash = require('child_process')
.execSync('git rev-parse --short HEAD')
.toString();
...
plugins: [
new webpack.DefinePlugin({
__COMMIT_HASH__: JSON.stringify(commitHash),
})
]
...
Then you can use it in your app with __COMMIT_HASH__