-
I am encountering an issue with the In my WXT project, I have implemented page component routing using basic When I use I am curious if this behavior could possibly be a bug related to the WXT production build process. Or did I configured anything incorrectly? For context, the versions of env and dependencies of my WXT project are:
I would appreciate any insights or assistance in resolving this issue. Thank you for your attention. The followings are the relevant files in my project: /entrypoints/popup/main.ts import { createApp } from "vue";
import App from "./App.vue";
import { router } from "./router";
createApp(App).use(router).mount("#app"); /entrypoints/popup/router.ts import { createRouter, createWebHashHistory } from "vue-router";
const routes = [
{ path: "/popup/page_a", component: import("@/components/popup/page_a.vue") },
{ path: "/popup/page_b", component: import("@/components/popup/page_b.vue") },
];
export const router = createRouter({
history: createWebHashHistory(),
routes,
}); /entrypoints/popup/App.vue <template>
<div>
<p>Click to change view</p>
<div>
<button>
<router-link to="/popup/page_a">Page A</router-link>
</button>
<button>
<router-link to="/popup/page_b">Page B</router-link>
</button>
</div>
<div style="border: 2px; border-color: blue;">
<router-view></router-view>
</div>
</div>
</template>
<script lang="ts" setup></script> |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hmm, interesting. I think you need to use arrow functions for the route const routes = [
- { path: "/popup/page_a", component: import("@/components/popup/page_a.vue") },
- { path: "/popup/page_b", component: import("@/components/popup/page_b.vue") },
+ { path: "/popup/page_a", component: () => import("@/components/popup/page_a.vue") },
+ { path: "/popup/page_b", component: () => import("@/components/popup/page_b.vue") },
]; |
Beta Was this translation helpful? Give feedback.
Hmm, interesting. I think you need to use arrow functions for the route
component
s? I didn't thinkcomponent
accepted promises, either a regular imported component or an arrow function with a dynamic import to split pages into chunks.