extract version from git tag
This commit is contained in:
1 parent
ff9a7c33eb
commit
4f17e84247
3 files changed
+21
-9
No files matched your search
+16
-8
@@ -1,12 +1,20 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { defineConfig, loadEnv } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import svgr from "vite-plugin-svgr";
|
||||
import { execSync } from "child_process";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
base: "/",
|
||||
plugins: [svgr(), react()],
|
||||
optimizeDeps: {
|
||||
include: ["@mui/material/Tooltip", "@emotion/styled"],
|
||||
},
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), "");
|
||||
const version =
|
||||
env.VITE_APP_VERSION || execSync("git describe --tags --abbrev=0").toString().trim();
|
||||
return {
|
||||
base: "/",
|
||||
plugins: [svgr(), react()],
|
||||
optimizeDeps: {
|
||||
include: ["@mui/material/Tooltip", "@emotion/styled"],
|
||||
},
|
||||
define: {
|
||||
__APP_VERSION__: JSON.stringify(version),
|
||||
},
|
||||
};
|
||||
});
|
||||
Reference in new issue
Block a user