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 {
@@ -365,6 +366,17 @@ class MiniCssExtractPlugin {
365366 ] ) ,
366367 '};' ,
367368 'linkTag.href = fullhref;' ,
369+ crossOriginLoading
370+ ? Template . asString ( [
371+ `if (linkTag.href.indexOf(window.location.origin + '/') !== 0) {` ,
372+ Template . indent (
373+ `linkTag.crossOrigin = ${ JSON . stringify (
374+ crossOriginLoading
375+ ) } ;`
376+ ) ,
377+ '}' ,
378+ ] )
379+ : '' ,
368380 'var head = document.getElementsByTagName("head")[0];' ,
369381 'head.appendChild(linkTag);' ,
370382 ] ) ,
You can’t perform that action at this time.
0 commit comments