Skip to content

Commit

Permalink
Manual for shouldPreload and shouldPrefetch
Browse files Browse the repository at this point in the history
Link for open issue: nuxt/nuxt#18376
  • Loading branch information
hicugi committed Feb 25, 2023
1 parent eccaaf5 commit 00f1985
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,20 @@ export default {
}
}
```

## shouldPreload & shouldPrefetch

Creates [\<link\>](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),
},
},
}
```

1 comment on commit 00f1985

@hicugi
Copy link
Contributor Author

@hicugi hicugi commented on 00f1985 Feb 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry - I did notice rules for commit after this commit ^^"

Please sign in to comment.