Skip to content

await router.isReady() gets blocked #434

@heriec

Description

@heriec

When I build, await router.isReady() gets blocked indefinitely. To reproduce this issue, I added this line of code in my main.ts, which indeed caused the subsequent code to be blocked, leaving a blank page in the browser.

Then, I found that my router does not block await router.isReady() when not using vite-ssg before.

Therefore, it might indicate where the problem lies? I have debugged this issue with await router.isReady() for a long time and even looked at many related issues but found no solution.

main.ts

import { ViteSSG } from 'vite-ssg';
import App from './App.vue';
import { routes} from '@/router';
//css
import '@/styles/index.scss';
import 'element-plus/dist/index.css';
import { loadSvg } from '@/icons';
import { setupPinia } from './store';


export const createApp = ViteSSG(App, { routes }, async (ctx) => {
  loadSvg(ctx.app);
  await ctx.router.isReady();
  setupPinia(ctx);
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions