From 27bfa06129ff559078ca78369e33e03129da49b4 Mon Sep 17 00:00:00 2001 From: Mag Date: Tue, 14 Mar 2023 22:33:32 +0600 Subject: [PATCH] Manual for shouldPreload and shouldPrefetch (#2211) Link for open issue: https://github.com/nuxt/nuxt/issues/18376 --- .../23.configuration-render.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/content/en/docs/5.configuration-glossary/23.configuration-render.md b/content/en/docs/5.configuration-glossary/23.configuration-render.md index efc44112c8..30ea1335ef 100644 --- a/content/en/docs/5.configuration-glossary/23.configuration-render.md +++ b/content/en/docs/5.configuration-glossary/23.configuration-render.md @@ -299,3 +299,20 @@ export default { } } ``` + +## shouldPreload & shouldPrefetch + +Creates [\](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link) tag with `rel="preload"` or `rel="prefetch"` for external resources (scripts, styles, etc.). + +Default configuration: + +```js +export default { + render: { + bundleRenderer: { + shouldPrefetch: () => false, + shouldPreload: (fileWithoutQuery, asType) => ["script", "style"].includes(asType), + }, + }, +} +```