@@ -619,6 +619,7 @@ exports[`create-webpack-app cli should generate react template with state and ro
619
619
"babel-loader": "x.x.x",
620
620
"css-loader": "x.x.x",
621
621
"html-webpack-plugin": "x.x.x",
622
+ "mini-css-extract-plugin": "x.x.x",
622
623
"postcss": "x.x.x",
623
624
"postcss-loader": "x.x.x",
624
625
"react": "x.x.x",
@@ -646,12 +647,13 @@ exports[`create-webpack-app cli should generate react template with state and ro
646
647
647
648
const path = require('path');
648
649
const HtmlWebpackPlugin = require('html-webpack-plugin');
650
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
649
651
const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
650
652
651
653
const isProduction = process.env.NODE_ENV === 'production';
652
654
653
655
654
- const stylesHandler = 'style-loader';
656
+ const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
655
657
656
658
657
659
@@ -709,6 +711,8 @@ module.exports = () => {
709
711
if (isProduction) {
710
712
config.mode = 'production';
711
713
714
+ config.plugins.push(new MiniCssExtractPlugin());
715
+
712
716
713
717
config.plugins.push(new WorkboxWebpackPlugin.GenerateSW());
714
718
@@ -848,6 +852,7 @@ exports[`create-webpack-app cli should generate svelte template with prompt answ
848
852
"babel-loader": "x.x.x",
849
853
"css-loader": "x.x.x",
850
854
"html-webpack-plugin": "x.x.x",
855
+ "mini-css-extract-plugin": "x.x.x",
851
856
"postcss": "x.x.x",
852
857
"postcss-loader": "x.x.x",
853
858
"style-loader": "x.x.x",
@@ -874,12 +879,13 @@ exports[`create-webpack-app cli should generate svelte template with prompt answ
874
879
875
880
const path = require('path');
876
881
const HtmlWebpackPlugin = require('html-webpack-plugin');
882
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
877
883
const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
878
884
const isProduction = process.env.NODE_ENV === 'production';
879
885
880
886
881
887
882
- const stylesHandler = 'style-loader';
888
+ const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
883
889
884
890
885
891
@@ -948,6 +954,8 @@ module.exports = () => {
948
954
if (isProduction) {
949
955
config.mode = 'production';
950
956
957
+ config.plugins.push(new MiniCssExtractPlugin());
958
+
951
959
952
960
config.plugins.push(new WorkboxWebpackPlugin.GenerateSW());
953
961
@@ -1157,6 +1165,7 @@ exports[`create-webpack-app cli should generate vue template with store and rout
1157
1165
"babel-loader": "x.x.x",
1158
1166
"css-loader": "x.x.x",
1159
1167
"html-webpack-plugin": "x.x.x",
1168
+ "mini-css-extract-plugin": "x.x.x",
1160
1169
"pinia": "x.x.x",
1161
1170
"postcss": "x.x.x",
1162
1171
"postcss-loader": "x.x.x",
@@ -1187,12 +1196,13 @@ exports[`create-webpack-app cli should generate vue template with store and rout
1187
1196
const path = require('path');
1188
1197
const { VueLoaderPlugin } = require('vue-loader');
1189
1198
const HtmlWebpackPlugin = require('html-webpack-plugin');
1199
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
1190
1200
const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
1191
1201
1192
1202
const isProduction = process.env.NODE_ENV === 'production';
1193
1203
1194
1204
1195
- const stylesHandler = 'vue-style-loader';
1205
+ const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : 'vue-style-loader';
1196
1206
1197
1207
1198
1208
@@ -1254,6 +1264,8 @@ module.exports = () => {
1254
1264
if (isProduction) {
1255
1265
config.mode = 'production';
1256
1266
1267
+ config.plugins.push(new MiniCssExtractPlugin());
1268
+
1257
1269
1258
1270
config.plugins.push(new WorkboxWebpackPlugin.GenerateSW());
1259
1271
@@ -1272,6 +1284,7 @@ exports[`create-webpack-app cli should use less in project when selected 1`] = `
1272
1284
"css-loader": "x.x.x",
1273
1285
"less": "x.x.x",
1274
1286
"less-loader": "x.x.x",
1287
+ "mini-css-extract-plugin": "x.x.x",
1275
1288
"style-loader": "x.x.x",
1276
1289
"webpack": "x.x.x",
1277
1290
"webpack-cli": "x.x.x",
@@ -1290,11 +1303,12 @@ exports[`create-webpack-app cli should use less in project when selected 2`] = `
1290
1303
"// Generated using webpack-cli https://github.com/webpack/webpack-cli
1291
1304
1292
1305
const path = require('path');
1306
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
1293
1307
1294
1308
const isProduction = process.env.NODE_ENV === 'production';
1295
1309
1296
1310
1297
- const stylesHandler = 'style-loader';
1311
+ const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
1298
1312
1299
1313
1300
1314
@@ -1329,6 +1343,8 @@ module.exports = () => {
1329
1343
if (isProduction) {
1330
1344
config.mode = 'production';
1331
1345
1346
+ config.plugins.push(new MiniCssExtractPlugin());
1347
+
1332
1348
1333
1349
} else {
1334
1350
config.mode = 'development';
@@ -1343,6 +1359,7 @@ exports[`create-webpack-app cli should use mini-css-extract-plugin when selected
1343
1359
"description": "My webpack project",
1344
1360
"devDependencies": {
1345
1361
"css-loader": "x.x.x",
1362
+ "mini-css-extract-plugin": "x.x.x",
1346
1363
"sass": "x.x.x",
1347
1364
"sass-loader": "x.x.x",
1348
1365
"style-loader": "x.x.x",
@@ -1363,11 +1380,12 @@ exports[`create-webpack-app cli should use mini-css-extract-plugin when selected
1363
1380
"// Generated using webpack-cli https://github.com/webpack/webpack-cli
1364
1381
1365
1382
const path = require('path');
1383
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
1366
1384
1367
1385
const isProduction = process.env.NODE_ENV === 'production';
1368
1386
1369
1387
1370
- const stylesHandler = 'style-loader';
1388
+ const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
1371
1389
1372
1390
1373
1391
@@ -1402,6 +1420,8 @@ module.exports = () => {
1402
1420
if (isProduction) {
1403
1421
config.mode = 'production';
1404
1422
1423
+ config.plugins.push(new MiniCssExtractPlugin());
1424
+
1405
1425
1406
1426
} else {
1407
1427
config.mode = 'development';
@@ -1417,6 +1437,7 @@ exports[`create-webpack-app cli should use postcss in project when selected 1`]
1417
1437
"devDependencies": {
1418
1438
"autoprefixer": "x.x.x",
1419
1439
"css-loader": "x.x.x",
1440
+ "mini-css-extract-plugin": "x.x.x",
1420
1441
"postcss": "x.x.x",
1421
1442
"postcss-loader": "x.x.x",
1422
1443
"style-loader": "x.x.x",
@@ -1437,11 +1458,12 @@ exports[`create-webpack-app cli should use postcss in project when selected 2`]
1437
1458
"// Generated using webpack-cli https://github.com/webpack/webpack-cli
1438
1459
1439
1460
const path = require('path');
1461
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
1440
1462
1441
1463
const isProduction = process.env.NODE_ENV === 'production';
1442
1464
1443
1465
1444
- const stylesHandler = 'style-loader';
1466
+ const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
1445
1467
1446
1468
1447
1469
@@ -1476,6 +1498,8 @@ module.exports = () => {
1476
1498
if (isProduction) {
1477
1499
config.mode = 'production';
1478
1500
1501
+ config.plugins.push(new MiniCssExtractPlugin());
1502
+
1479
1503
1480
1504
} else {
1481
1505
config.mode = 'development';
@@ -1491,6 +1515,7 @@ exports[`create-webpack-app cli should use sass and css with postcss in project
1491
1515
"devDependencies": {
1492
1516
"autoprefixer": "x.x.x",
1493
1517
"css-loader": "x.x.x",
1518
+ "mini-css-extract-plugin": "x.x.x",
1494
1519
"postcss": "x.x.x",
1495
1520
"postcss-loader": "x.x.x",
1496
1521
"sass": "x.x.x",
@@ -1513,11 +1538,12 @@ exports[`create-webpack-app cli should use sass and css with postcss in project
1513
1538
"// Generated using webpack-cli https://github.com/webpack/webpack-cli
1514
1539
1515
1540
const path = require('path');
1541
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
1516
1542
1517
1543
const isProduction = process.env.NODE_ENV === 'production';
1518
1544
1519
1545
1520
- const stylesHandler = 'style-loader';
1546
+ const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
1521
1547
1522
1548
1523
1549
@@ -1556,6 +1582,8 @@ module.exports = () => {
1556
1582
if (isProduction) {
1557
1583
config.mode = 'production';
1558
1584
1585
+ config.plugins.push(new MiniCssExtractPlugin());
1586
+
1559
1587
1560
1588
} else {
1561
1589
config.mode = 'development';
@@ -1570,6 +1598,7 @@ exports[`create-webpack-app cli should use sass in project when selected 1`] = `
1570
1598
"description": "My webpack project",
1571
1599
"devDependencies": {
1572
1600
"css-loader": "x.x.x",
1601
+ "mini-css-extract-plugin": "x.x.x",
1573
1602
"sass": "x.x.x",
1574
1603
"sass-loader": "x.x.x",
1575
1604
"style-loader": "x.x.x",
@@ -1590,11 +1619,12 @@ exports[`create-webpack-app cli should use sass in project when selected 2`] = `
1590
1619
"// Generated using webpack-cli https://github.com/webpack/webpack-cli
1591
1620
1592
1621
const path = require('path');
1622
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
1593
1623
1594
1624
const isProduction = process.env.NODE_ENV === 'production';
1595
1625
1596
1626
1597
- const stylesHandler = 'style-loader';
1627
+ const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
1598
1628
1599
1629
1600
1630
@@ -1629,6 +1659,8 @@ module.exports = () => {
1629
1659
if (isProduction) {
1630
1660
config.mode = 'production';
1631
1661
1662
+ config.plugins.push(new MiniCssExtractPlugin());
1663
+
1632
1664
1633
1665
} else {
1634
1666
config.mode = 'development';
@@ -1644,6 +1676,7 @@ exports[`create-webpack-app cli should use sass with postcss in project when sel
1644
1676
"devDependencies": {
1645
1677
"autoprefixer": "x.x.x",
1646
1678
"css-loader": "x.x.x",
1679
+ "mini-css-extract-plugin": "x.x.x",
1647
1680
"postcss": "x.x.x",
1648
1681
"postcss-loader": "x.x.x",
1649
1682
"sass": "x.x.x",
@@ -1666,11 +1699,12 @@ exports[`create-webpack-app cli should use sass with postcss in project when sel
1666
1699
"// Generated using webpack-cli https://github.com/webpack/webpack-cli
1667
1700
1668
1701
const path = require('path');
1702
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
1669
1703
1670
1704
const isProduction = process.env.NODE_ENV === 'production';
1671
1705
1672
1706
1673
- const stylesHandler = 'style-loader';
1707
+ const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
1674
1708
1675
1709
1676
1710
@@ -1705,6 +1739,8 @@ module.exports = () => {
1705
1739
if (isProduction) {
1706
1740
config.mode = 'production';
1707
1741
1742
+ config.plugins.push(new MiniCssExtractPlugin());
1743
+
1708
1744
1709
1745
} else {
1710
1746
config.mode = 'development';
@@ -1719,6 +1755,7 @@ exports[`create-webpack-app cli should use stylus in project when selected 1`] =
1719
1755
"description": "My webpack project",
1720
1756
"devDependencies": {
1721
1757
"css-loader": "x.x.x",
1758
+ "mini-css-extract-plugin": "x.x.x",
1722
1759
"style-loader": "x.x.x",
1723
1760
"stylus": "x.x.x",
1724
1761
"stylus-loader": "x.x.x",
@@ -1739,11 +1776,12 @@ exports[`create-webpack-app cli should use stylus in project when selected 2`] =
1739
1776
"// Generated using webpack-cli https://github.com/webpack/webpack-cli
1740
1777
1741
1778
const path = require('path');
1779
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
1742
1780
1743
1781
const isProduction = process.env.NODE_ENV === 'production';
1744
1782
1745
1783
1746
- const stylesHandler = 'style-loader';
1784
+ const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
1747
1785
1748
1786
1749
1787
@@ -1778,6 +1816,8 @@ module.exports = () => {
1778
1816
if (isProduction) {
1779
1817
config.mode = 'production';
1780
1818
1819
+ config.plugins.push(new MiniCssExtractPlugin());
1820
+
1781
1821
1782
1822
} else {
1783
1823
config.mode = 'development';
0 commit comments