Skip to content

Commit

Permalink
fix(web): embed git commit hash from vite in correct way (#1049)
Browse files Browse the repository at this point in the history
  • Loading branch information
keiya01 authored Jul 3, 2024
1 parent 66dd4de commit f408ac8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions web/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import wdyr from "./wdyr";

window.React = React;
window.ReactDOM = ReactDOM;
window.REEARTH_COMMIT_HASH = __REEARTH_COMMIT_HASH__;

loadConfig().finally(async () => {
const element = document.getElementById("root");
Expand Down
2 changes: 2 additions & 0 deletions web/src/services/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ export type Config = {

declare global {
let __APP_VERSION__: string;
let __REEARTH_COMMIT_HASH__: string;
interface Window {
REEARTH_CONFIG?: Config;
REEARTH_E2E_ACCESS_TOKEN?: string;
REEARTH_E2E_CESIUM_VIEWER?: any;
REEARTH_COMMIT_HASH?: string;
}
}

Expand Down
2 changes: 1 addition & 1 deletion web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default defineConfig({
define: {
"process.env.QTS_DEBUG": "false", // quickjs-emscripten
__APP_VERSION__: JSON.stringify(pkg.version),
"window.REEARTH_COMMIT_HASH": JSON.stringify(commitHash),
__REEARTH_COMMIT_HASH__: JSON.stringify(commitHash),
},
mode: NO_MINIFY ? "development" : undefined,
server: {
Expand Down

0 comments on commit f408ac8

Please sign in to comment.