safely extract version
This commit is contained in:
1 parent
4f17e84247
commit
8d6078e2c1
1 file changed
+9
-2
@@ -5,8 +5,15 @@ import { execSync } from "child_process";
|
|||||||
|
|
||||||
export default defineConfig(({ mode }) => {
|
export default defineConfig(({ mode }) => {
|
||||||
const env = loadEnv(mode, process.cwd(), "");
|
const env = loadEnv(mode, process.cwd(), "");
|
||||||
const version =
|
let version;
|
||||||
env.VITE_APP_VERSION || execSync("git describe --tags --abbrev=0").toString().trim();
|
try {
|
||||||
|
version =
|
||||||
|
env.VITE_APP_VERSION ||
|
||||||
|
execSync("git describe --tags --abbrev=0").toString().trim();
|
||||||
|
} catch (error) {
|
||||||
|
version = "unknown";
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
base: "/",
|
base: "/",
|
||||||
plugins: [svgr(), react()],
|
plugins: [svgr(), react()],
|
||||||
|
|||||||
Reference in new issue
Block a user