You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, scripts are loaded when Nuxt is fully hydrated. You can change this default by modifying the [defaultScriptOptions](/docs/api/nuxt-config#defaultscriptoptions).
60
+
By default, scripts are loaded when Nuxt is fully hydrated using the `onNuxtReady` trigger. This provides an "idle loading" behavior where scripts load only after the page is fully interactive, minimizing impact on Core Web Vitals and user experience.
61
+
62
+
The `onNuxtReady` trigger ensures scripts load:
63
+
- After Nuxt hydration is complete
64
+
- When the browser is idle and the main thread is available
65
+
- Without blocking critical page rendering or user interactions
66
+
67
+
This is more effective than using `defer` or `fetchpriority="low"` attributes alone, as it waits for the application to be fully ready rather than just the HTML parsing to complete.
68
+
69
+
You can change this default by modifying the [defaultScriptOptions](/docs/api/nuxt-config#defaultscriptoptions).
70
+
71
+
## Idle Loading with onNuxtReady
72
+
73
+
The `onNuxtReady` trigger is perfect for non-critical scripts like chat widgets, analytics, or marketing tools that should load with minimal performance impact:
74
+
75
+
```ts
76
+
// Chat widget - loads after page is fully interactive
0 commit comments