Skip to content

Commit 6cf3807

Browse files
committed
ensure globalRTLFlag is optional
1 parent ada091c commit 6cf3807

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,15 +325,23 @@ class MiniCssExtractPlugin {
325325
source,
326326
'',
327327
`// ${pluginName} CSS loading`,
328-
`var fetchRTL = !!window['${this.options.globalRTLFlag}'];`,
328+
`var fetchRTL = ${
329+
this.options.globalRTLFlag
330+
? `window['${this.options.globalRTLFlag}']`
331+
: false
332+
};`,
329333
`var cssChunks = ${JSON.stringify(chunkMap)};`,
330334
'if(installedCssChunks[chunkId]) promises.push(installedCssChunks[chunkId]);',
331335
'else if(installedCssChunks[chunkId] !== 0 && cssChunks[chunkId]) {',
332336
Template.indent([
333337
'promises.push(installedCssChunks[chunkId] = new Promise(function(resolve, reject) {',
334338
Template.indent([
335339
`var href = ${linkHrefPath};`,
336-
`var fullhref = ${this.options.outputPublicPath ? `'${this.options.outputPublicPath}'` : `${mainTemplate.requireFn}.p`} + href;`,
340+
`var fullhref = ${
341+
this.options.outputPublicPath
342+
? `'${this.options.outputPublicPath}'`
343+
: `${mainTemplate.requireFn}.p`
344+
} + href;`,
337345
'if (fetchRTL) {',
338346
Template.indent([
339347
`fullhref = fullhref.replace(/\\.css/i, '.rtl.css');`,

0 commit comments

Comments
 (0)