File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -272,6 +272,7 @@ class MiniCssExtractPlugin {
272272 const chunkMap = this . getCssChunkObject ( chunk ) ;
273273 if ( Object . keys ( chunkMap ) . length > 0 ) {
274274 const chunkMaps = chunk . getChunkMaps ( ) ;
275+ const { crossOriginLoading } = mainTemplate . outputOptions ;
275276 const linkHrefPath = mainTemplate . getAssetPath (
276277 JSON . stringify ( this . options . chunkFilename ) ,
277278 {
@@ -363,6 +364,17 @@ class MiniCssExtractPlugin {
363364 ] ) ,
364365 '};' ,
365366 'linkTag.href = fullhref;' ,
367+ crossOriginLoading
368+ ? Template . asString ( [
369+ `if (linkTag.href.indexOf(window.location.origin + '/') !== 0) {` ,
370+ Template . indent (
371+ `linkTag.crossOrigin = ${ JSON . stringify (
372+ crossOriginLoading
373+ ) } ;`
374+ ) ,
375+ '}' ,
376+ ] )
377+ : '' ,
366378 'var head = document.getElementsByTagName("head")[0];' ,
367379 'head.appendChild(linkTag);' ,
368380 ] ) ,
You can’t perform that action at this time.
0 commit comments