Skip to content

Commit

Permalink
perf: add preload for script (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong authored Nov 20, 2024
1 parent af458ac commit 3fc77b8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/runtime/plugin.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ export default defineNuxtPlugin({
const strategy = options.loadingStrategy === 'async' ? 'async' : 'defer'

useHead({
link: [
{
rel: 'preload',
as: 'script',
href: withQuery(options.url, { id: tags[0].id }),
},
],
script: [
{
'src': withQuery(options.url, { id: tags[0].id }),
Expand Down

0 comments on commit 3fc77b8

Please sign in to comment.