diff --git a/kyuubi-server/web-ui/.env b/kyuubi-server/web-ui/.env
new file mode 100644
index 000000000..fb092780f
--- /dev/null
+++ b/kyuubi-server/web-ui/.env
@@ -0,0 +1,16 @@
+ # Licensed to the Apache Software Foundation (ASF) under one or more
+ # contributor license agreements. See the NOTICE file distributed with
+ # this work for additional information regarding copyright ownership.
+ # The ASF licenses this file to You under the Apache License, Version 2.0
+ # (the "License"); you may not use this file except in compliance with
+ # the License. You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+
+VITE_APP_VERSION=$npm_package_version
diff --git a/kyuubi-server/web-ui/src/layout/components/aside/index.vue b/kyuubi-server/web-ui/src/layout/components/aside/index.vue
index 4d82c6144..78cbbc774 100644
--- a/kyuubi-server/web-ui/src/layout/components/aside/index.vue
+++ b/kyuubi-server/web-ui/src/layout/components/aside/index.vue
@@ -20,7 +20,7 @@
- {{ title }}
+ {{ version }}
@@ -38,11 +38,7 @@
const { isCollapse } = storeToRefs(store)
const router = useRoute()
const activePath = ref(router.path)
- /* eslint-disable */
- // define __APP_VERSION__ in vite.config.ts
- // @ts-ignore
- const title = `${__APP_VERSION__}`
- /* eslint-enable */
+ const version = import.meta.env.VITE_APP_VERSION
diff --git a/kyuubi-server/web-ui/vite.config.ts b/kyuubi-server/web-ui/vite.config.ts
index 9470319f3..b6786a0c1 100644
--- a/kyuubi-server/web-ui/vite.config.ts
+++ b/kyuubi-server/web-ui/vite.config.ts
@@ -44,9 +44,6 @@ export default defineConfig(({ mode }) => {
changeOrigin: true
}
}
- },
- define: {
- __APP_VERSION__: JSON.stringify(require('./package.json').version)
}
}
})
diff --git a/kyuubi-server/web-ui/vitest.config.ts b/kyuubi-server/web-ui/vitest.config.ts
index e79ecf164..11955299c 100644
--- a/kyuubi-server/web-ui/vitest.config.ts
+++ b/kyuubi-server/web-ui/vitest.config.ts
@@ -39,8 +39,5 @@ export default defineConfig({
test: {
globals: true,
environment: 'jsdom'
- },
- define: {
- __APP_VERSION__: JSON.stringify(require('./package.json').version)
}
})