UNPKG

nuxt

Version:

Nuxt is a free and open-source framework with an intuitive and extendable way to create type-safe, performant and production-grade full-stack web applications and websites with Vue.js.

19 lines (18 loc) 597 B
import { defineNuxtPlugin } from "../nuxt.js"; import { isBotUserAgent } from "../utils.js"; import { reloadNuxtApp } from "../composables/chunk.js"; //#region src/app/plugins/chunk-reload-crawler.client.ts const plugin = /* @__PURE__ */ defineNuxtPlugin({ name: "nuxt:chunk-reload-crawler", setup(nuxtApp) { let isHydrating = true; nuxtApp.hooks.hookOnce("app:suspense:resolve", () => { isHydrating = false; }); nuxtApp.hook("app:chunkError", () => { if (isHydrating && isBotUserAgent(navigator.userAgent)) reloadNuxtApp(); }); } }); //#endregion export { plugin as default };