@@ -113,11 +113,11 @@ class ExtractCssChunksPlugin {
113
113
// the parameter or globally available stuff like `window.x`
114
114
// note: here we are using a plain ES5 function as a default, cause we don't
115
115
// know what env this code will be run
116
- /* eslint-disable func-names, object-shorthand, prefer-template */
116
+ /* eslint-disable func-names, object-shorthand */
117
117
processLinkHref : function ( x ) {
118
118
return x ;
119
119
} ,
120
- /* eslint-enable func-names, object-shorthand, prefer-template */
120
+ /* eslint-enable func-names, object-shorthand */
121
121
} ,
122
122
options ,
123
123
{ insert }
@@ -332,7 +332,7 @@ class ExtractCssChunksPlugin {
332
332
contentHashType : MODULE_TYPE ,
333
333
}
334
334
) ;
335
- const { insert } = this . options ;
335
+ const { insert, processLinkHref } = this . options ;
336
336
const supportsPreload =
337
337
'(function() { try { return document.createElement("link").relList.supports("preload"); } catch(e) { return false; }}());' ;
338
338
return Template . asString ( [
@@ -341,12 +341,12 @@ class ExtractCssChunksPlugin {
341
341
`// ${ pluginName } CSS loading` ,
342
342
`var supportsPreload = ${ supportsPreload } ` ,
343
343
`var cssChunks = ${ JSON . stringify ( chunkMap ) } ;` ,
344
+ `var processLinkHref = ${ processLinkHref } ;` ,
344
345
'if(installedCssChunks[chunkId]) promises.push(installedCssChunks[chunkId]);' ,
345
346
'else if(installedCssChunks[chunkId] !== 0 && cssChunks[chunkId]) {' ,
346
347
Template . indent ( [
347
348
'promises.push(installedCssChunks[chunkId] = new Promise(function(resolve, reject) {' ,
348
349
Template . indent ( [
349
- `var processLinkHref = ${ this . options . processLinkHref } ;` ,
350
350
`var href = ${ linkHrefPath } ;` ,
351
351
`var fullhref = processLinkHref(${ mainTemplate . requireFn } .p + href);` ,
352
352
'var existingLinkTags = document.getElementsByTagName("link");' ,
@@ -402,7 +402,7 @@ class ExtractCssChunksPlugin {
402
402
'if(supportsPreload) {' ,
403
403
Template . indent ( [
404
404
'var execLinkTag = document.createElement("link");' ,
405
- `execLinkTag.href = ${ mainTemplate . requireFn } .p + ${ linkHrefPath } ;` ,
405
+ `execLinkTag.href = processLinkHref( ${ mainTemplate . requireFn } .p + ${ linkHrefPath } ) ;` ,
406
406
'execLinkTag.rel = "stylesheet";' ,
407
407
'execLinkTag.type = "text/css";' ,
408
408
'document.body.appendChild(execLinkTag);' ,
0 commit comments