File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727 "test:only" : " cross-env NODE_ENV=test jest" ,
2828 "test:watch" : " cross-env NODE_ENV=test jest --watch" ,
2929 "test:coverage" : " cross-env NODE_ENV=test jest --collectCoverageFrom=\" src/**/*.js\" --coverage" ,
30- "test:manual" : " webpack-dev-server test/manual/src/index.js --open -- config test/manual/webpack.config.js" ,
30+ "test:manual" : " webpack-dev-server test/manual/src/index.js --config test/manual/webpack.config.js" ,
3131 "pretest" : " npm run lint" ,
3232 "test" : " cross-env NODE_ENV=test npm run test:coverage" ,
3333 "defaults" : " webpack-defaults"
Original file line number Diff line number Diff line change @@ -325,6 +325,7 @@ class MiniCssExtractPlugin {
325325 source ,
326326 '' ,
327327 `// ${ pluginName } CSS loading` ,
328+ `var fetchRTL = !!window['${ this . options . globalRTLFlag } '];` ,
328329 `var cssChunks = ${ JSON . stringify ( chunkMap ) } ;` ,
329330 'if(installedCssChunks[chunkId]) promises.push(installedCssChunks[chunkId]);' ,
330331 'else if(installedCssChunks[chunkId] !== 0 && cssChunks[chunkId]) {' ,
@@ -333,6 +334,11 @@ class MiniCssExtractPlugin {
333334 Template . indent ( [
334335 `var href = ${ linkHrefPath } ;` ,
335336 `var fullhref = ${ mainTemplate . requireFn } .p + href;` ,
337+ 'if (fetchRTL) {' ,
338+ Template . indent ( [
339+ `fullhref = fullhref.replace(/\\.css/i, '.rtl.css');` ,
340+ ] ) ,
341+ '}' ,
336342 'var existingLinkTags = document.getElementsByTagName("link");' ,
337343 'for(var i = 0; i < existingLinkTags.length; i++) {' ,
338344 Template . indent ( [
Original file line number Diff line number Diff line change 1010 "instanceof" : " Function"
1111 }
1212 ]
13+ },
14+ "globalRTLFlag" : {
15+ "type" : " string"
1316 }
1417 },
1518 "errorMessages" : {
Original file line number Diff line number Diff line change 55 < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
66 < title > mini-css-extract-plugin testcase</ title >
77 < meta name ="viewport " content ="width=device-width, initial-scale=1 ">
8- < link rel ="stylesheet " type ="text/css " href ="/dist/preloaded1.css " />
8+ < link rel ="stylesheet " type ="text/css " href ="/dist/preloaded1.client. css " />
99 < style >
1010 .test {
1111 background : lightcoral;
2323 background : lightgreen;
2424 }
2525 </ style >
26- < link rel ="stylesheet " type ="text/css " href ="/dist/main.css " />
26+ < link rel ="stylesheet " type ="text/css " href ="/dist/main.client. css " />
2727</ head >
2828< body >
2929 < div class ="test initial-css ">
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ module.exports = {
1717 } ,
1818 plugins : [
1919 new Self ( {
20- filename : '[name].css' ,
21- chunkFilename : '[contenthash].css' ,
20+ filename : '[name].client.css' ,
21+ chunkFilename : '[name].chunk.client.css' ,
22+ globalRTLFlag : 'rtlLanguageEnabled' ,
2223 } ) ,
2324 ] ,
2425 devServer : {
You can’t perform that action at this time.
0 commit comments