Skip to content

Commit

Permalink
try/catch around webpack git command
Browse files Browse the repository at this point in the history
return a blank string for git revision if 'git' not available
or 'git' command executed outside a git repository
  • Loading branch information
gstrauss committed Dec 10, 2024
1 parent b342d4b commit 0bb3cfd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ const production = process.env.NODE_ENV === 'production';

// function that returns the github short revision
const revision = () => {
try {
return exec('git', ['rev-parse', '--short', 'HEAD'], { encoding: 'ascii' }).stdout.trim();
} catch (error) {
return '';
}
}

// the many plugins used
Expand Down

0 comments on commit 0bb3cfd

Please sign in to comment.