This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-booster-ui.git
The following commit(s) were added to refs/heads/main by this push:
new 344f2a66 fix: cannot access uninitialized variable on Safari (#308)
344f2a66 is described below
commit 344f2a6608160e20da6bd5c5dd83f664dac85152
Author: Fine0830 <[email protected]>
AuthorDate: Tue Aug 1 15:12:00 2023 +0800
fix: cannot access uninitialized variable on Safari (#308)
---
src/main.ts | 6 ++++--
src/router/index.ts | 2 +-
src/router/layer.ts | 5 ++---
vite.config.ts | 2 +-
4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/main.ts b/src/main.ts
index d9bfb839..d051bb83 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -16,7 +16,6 @@
*/
import { createApp } from "vue";
import App from "./App.vue";
-import router from "./router";
import { store } from "./store";
import components from "@/components";
import i18n from "./locales";
@@ -33,6 +32,9 @@ app.use(store);
mountApp();
async function mountApp() {
+ await appStore.getActivateMenus();
await appStore.queryOAPTimeInfo();
- app.use(router).mount("#app");
+
+ const router = await import("./router");
+ app.use(router.default).mount("#app");
}
diff --git a/src/router/index.ts b/src/router/index.ts
index bf8fe555..60eebf24 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -22,7 +22,7 @@ import { routesAlarm } from "./alarm";
import routesLayers from "./layer";
import { routesSettings } from "./settings";
-const routes: Array<RouteRecordRaw> = [
+const routes: RouteRecordRaw[] = [
...routesMarketplace,
...routesLayers,
...routesAlarm,
diff --git a/src/router/layer.ts b/src/router/layer.ts
index ec9c98e2..c5b436e8 100644
--- a/src/router/layer.ts
+++ b/src/router/layer.ts
@@ -18,9 +18,8 @@ import Layout from "@/layout/Index.vue";
import { useAppStoreWithOut } from "@/store/modules/app";
import type { MenuOptions } from "@/types/app";
-async function layerDashboards() {
+function layerDashboards() {
const appStore = useAppStoreWithOut();
- await appStore.getActivateMenus();
const routes = appStore.allMenus.map((item: MenuOptions) => {
const route: any = {
path: "",
@@ -84,4 +83,4 @@ async function layerDashboards() {
return routes;
}
-export default await layerDashboards();
+export default layerDashboards();
diff --git a/vite.config.ts b/vite.config.ts
index a70ea4b6..f5b596eb 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -79,7 +79,7 @@ export default ({ mode }: ConfigEnv): UserConfig => {
},
},
build: {
- target: "esnext",
+ target: "es2015",
outDir: OUTPUT_DIR,
manifest: false,
sourcemap: false,