Skip to content

Commit 711f526

Browse files
committed
chore: update resource hints
1 parent 309f8dd commit 711f526

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

src/index.js

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,14 @@ class PreloadPlugin {
8383
rel: options.rel
8484
}
8585

86-
// If we're preloading this resource (as opposed to prefetching),
87-
// then we need to set the 'as' attribute correctly.
88-
if (options.rel === 'preload') {
89-
attributes.as = determineAsValue({
90-
href,
91-
file,
92-
optionsAs: options.as
93-
})
94-
95-
// On the off chance that we have a cross-origin 'href' attribute,
96-
// set crossOrigin on the <link> to trigger CORS mode. Non-CORS
97-
// fonts can't be used.
98-
if (attributes.as === 'font') {
99-
attributes.crossorigin = ''
100-
}
86+
attributes.as = determineAsValue({
87+
href,
88+
file,
89+
optionsAs: options.as
90+
})
91+
92+
if (attributes.as === 'font') {
93+
attributes.crossorigin = ''
10194
}
10295

10396
links.push({

0 commit comments

Comments
 (0)