@@ -619,6 +619,7 @@ exports[`create-webpack-app cli should generate react template with state and ro
619619 "babel-loader": "x.x.x",
620620 "css-loader": "x.x.x",
621621 "html-webpack-plugin": "x.x.x",
622+ "mini-css-extract-plugin": "x.x.x",
622623 "postcss": "x.x.x",
623624 "postcss-loader": "x.x.x",
624625 "react": "x.x.x",
@@ -646,12 +647,13 @@ exports[`create-webpack-app cli should generate react template with state and ro
646647
647648const path = require('path');
648649const HtmlWebpackPlugin = require('html-webpack-plugin');
650+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
649651const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
650652
651653const isProduction = process.env.NODE_ENV === 'production';
652654
653655
654- const stylesHandler = 'style-loader';
656+ const stylesHandler =isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
655657
656658
657659
@@ -709,6 +711,8 @@ module.exports = () => {
709711 if (isProduction) {
710712 config.mode = 'production';
711713
714+ config.plugins.push(new MiniCssExtractPlugin());
715+
712716
713717 config.plugins.push(new WorkboxWebpackPlugin.GenerateSW());
714718
@@ -848,6 +852,7 @@ exports[`create-webpack-app cli should generate svelte template with prompt answ
848852 "babel-loader": "x.x.x",
849853 "css-loader": "x.x.x",
850854 "html-webpack-plugin": "x.x.x",
855+ "mini-css-extract-plugin": "x.x.x",
851856 "postcss": "x.x.x",
852857 "postcss-loader": "x.x.x",
853858 "style-loader": "x.x.x",
@@ -874,12 +879,13 @@ exports[`create-webpack-app cli should generate svelte template with prompt answ
874879
875880const path = require('path');
876881const HtmlWebpackPlugin = require('html-webpack-plugin');
882+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
877883const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
878884const isProduction = process.env.NODE_ENV === 'production';
879885
880886
881887
882- const stylesHandler = 'style-loader';
888+ const stylesHandler =isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
883889
884890
885891
@@ -948,6 +954,8 @@ module.exports = () => {
948954 if (isProduction) {
949955 config.mode = 'production';
950956
957+ config.plugins.push(new MiniCssExtractPlugin());
958+
951959
952960 config.plugins.push(new WorkboxWebpackPlugin.GenerateSW());
953961
@@ -1157,6 +1165,7 @@ exports[`create-webpack-app cli should generate vue template with store and rout
11571165 "babel-loader": "x.x.x",
11581166 "css-loader": "x.x.x",
11591167 "html-webpack-plugin": "x.x.x",
1168+ "mini-css-extract-plugin": "x.x.x",
11601169 "pinia": "x.x.x",
11611170 "postcss": "x.x.x",
11621171 "postcss-loader": "x.x.x",
@@ -1187,12 +1196,13 @@ exports[`create-webpack-app cli should generate vue template with store and rout
11871196const path = require('path');
11881197const { VueLoaderPlugin } = require('vue-loader');
11891198const HtmlWebpackPlugin = require('html-webpack-plugin');
1199+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
11901200const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
11911201
11921202const isProduction = process.env.NODE_ENV === 'production';
11931203
11941204
1195- const stylesHandler = 'vue-style-loader';
1205+ const stylesHandler =isProduction ? MiniCssExtractPlugin.loader : 'vue-style-loader';
11961206
11971207
11981208
@@ -1254,6 +1264,8 @@ module.exports = () => {
12541264 if (isProduction) {
12551265 config.mode = 'production';
12561266
1267+ config.plugins.push(new MiniCssExtractPlugin());
1268+
12571269
12581270 config.plugins.push(new WorkboxWebpackPlugin.GenerateSW());
12591271
@@ -1272,6 +1284,7 @@ exports[`create-webpack-app cli should use less in project when selected 1`] = `
12721284 "css-loader": "x.x.x",
12731285 "less": "x.x.x",
12741286 "less-loader": "x.x.x",
1287+ "mini-css-extract-plugin": "x.x.x",
12751288 "style-loader": "x.x.x",
12761289 "webpack": "x.x.x",
12771290 "webpack-cli": "x.x.x",
@@ -1290,11 +1303,12 @@ exports[`create-webpack-app cli should use less in project when selected 2`] = `
12901303"// Generated using webpack-cli https://github.com/webpack/webpack-cli
12911304
12921305const path = require('path');
1306+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
12931307
12941308const isProduction = process.env.NODE_ENV === 'production';
12951309
12961310
1297- const stylesHandler = 'style-loader';
1311+ const stylesHandler =isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
12981312
12991313
13001314
@@ -1329,6 +1343,8 @@ module.exports = () => {
13291343 if (isProduction) {
13301344 config.mode = 'production';
13311345
1346+ config.plugins.push(new MiniCssExtractPlugin());
1347+
13321348
13331349 } else {
13341350 config.mode = 'development';
@@ -1343,6 +1359,7 @@ exports[`create-webpack-app cli should use mini-css-extract-plugin when selected
13431359 "description": "My webpack project",
13441360 "devDependencies": {
13451361 "css-loader": "x.x.x",
1362+ "mini-css-extract-plugin": "x.x.x",
13461363 "sass": "x.x.x",
13471364 "sass-loader": "x.x.x",
13481365 "style-loader": "x.x.x",
@@ -1363,11 +1380,12 @@ exports[`create-webpack-app cli should use mini-css-extract-plugin when selected
13631380"// Generated using webpack-cli https://github.com/webpack/webpack-cli
13641381
13651382const path = require('path');
1383+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
13661384
13671385const isProduction = process.env.NODE_ENV === 'production';
13681386
13691387
1370- const stylesHandler = 'style-loader';
1388+ const stylesHandler =isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
13711389
13721390
13731391
@@ -1402,6 +1420,8 @@ module.exports = () => {
14021420 if (isProduction) {
14031421 config.mode = 'production';
14041422
1423+ config.plugins.push(new MiniCssExtractPlugin());
1424+
14051425
14061426 } else {
14071427 config.mode = 'development';
@@ -1417,6 +1437,7 @@ exports[`create-webpack-app cli should use postcss in project when selected 1`]
14171437 "devDependencies": {
14181438 "autoprefixer": "x.x.x",
14191439 "css-loader": "x.x.x",
1440+ "mini-css-extract-plugin": "x.x.x",
14201441 "postcss": "x.x.x",
14211442 "postcss-loader": "x.x.x",
14221443 "style-loader": "x.x.x",
@@ -1437,11 +1458,12 @@ exports[`create-webpack-app cli should use postcss in project when selected 2`]
14371458"// Generated using webpack-cli https://github.com/webpack/webpack-cli
14381459
14391460const path = require('path');
1461+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
14401462
14411463const isProduction = process.env.NODE_ENV === 'production';
14421464
14431465
1444- const stylesHandler = 'style-loader';
1466+ const stylesHandler =isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
14451467
14461468
14471469
@@ -1476,6 +1498,8 @@ module.exports = () => {
14761498 if (isProduction) {
14771499 config.mode = 'production';
14781500
1501+ config.plugins.push(new MiniCssExtractPlugin());
1502+
14791503
14801504 } else {
14811505 config.mode = 'development';
@@ -1491,6 +1515,7 @@ exports[`create-webpack-app cli should use sass and css with postcss in project
14911515 "devDependencies": {
14921516 "autoprefixer": "x.x.x",
14931517 "css-loader": "x.x.x",
1518+ "mini-css-extract-plugin": "x.x.x",
14941519 "postcss": "x.x.x",
14951520 "postcss-loader": "x.x.x",
14961521 "sass": "x.x.x",
@@ -1513,11 +1538,12 @@ exports[`create-webpack-app cli should use sass and css with postcss in project
15131538"// Generated using webpack-cli https://github.com/webpack/webpack-cli
15141539
15151540const path = require('path');
1541+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
15161542
15171543const isProduction = process.env.NODE_ENV === 'production';
15181544
15191545
1520- const stylesHandler = 'style-loader';
1546+ const stylesHandler =isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
15211547
15221548
15231549
@@ -1556,6 +1582,8 @@ module.exports = () => {
15561582 if (isProduction) {
15571583 config.mode = 'production';
15581584
1585+ config.plugins.push(new MiniCssExtractPlugin());
1586+
15591587
15601588 } else {
15611589 config.mode = 'development';
@@ -1570,6 +1598,7 @@ exports[`create-webpack-app cli should use sass in project when selected 1`] = `
15701598 "description": "My webpack project",
15711599 "devDependencies": {
15721600 "css-loader": "x.x.x",
1601+ "mini-css-extract-plugin": "x.x.x",
15731602 "sass": "x.x.x",
15741603 "sass-loader": "x.x.x",
15751604 "style-loader": "x.x.x",
@@ -1590,11 +1619,12 @@ exports[`create-webpack-app cli should use sass in project when selected 2`] = `
15901619"// Generated using webpack-cli https://github.com/webpack/webpack-cli
15911620
15921621const path = require('path');
1622+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
15931623
15941624const isProduction = process.env.NODE_ENV === 'production';
15951625
15961626
1597- const stylesHandler = 'style-loader';
1627+ const stylesHandler =isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
15981628
15991629
16001630
@@ -1629,6 +1659,8 @@ module.exports = () => {
16291659 if (isProduction) {
16301660 config.mode = 'production';
16311661
1662+ config.plugins.push(new MiniCssExtractPlugin());
1663+
16321664
16331665 } else {
16341666 config.mode = 'development';
@@ -1644,6 +1676,7 @@ exports[`create-webpack-app cli should use sass with postcss in project when sel
16441676 "devDependencies": {
16451677 "autoprefixer": "x.x.x",
16461678 "css-loader": "x.x.x",
1679+ "mini-css-extract-plugin": "x.x.x",
16471680 "postcss": "x.x.x",
16481681 "postcss-loader": "x.x.x",
16491682 "sass": "x.x.x",
@@ -1666,11 +1699,12 @@ exports[`create-webpack-app cli should use sass with postcss in project when sel
16661699"// Generated using webpack-cli https://github.com/webpack/webpack-cli
16671700
16681701const path = require('path');
1702+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
16691703
16701704const isProduction = process.env.NODE_ENV === 'production';
16711705
16721706
1673- const stylesHandler = 'style-loader';
1707+ const stylesHandler =isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
16741708
16751709
16761710
@@ -1705,6 +1739,8 @@ module.exports = () => {
17051739 if (isProduction) {
17061740 config.mode = 'production';
17071741
1742+ config.plugins.push(new MiniCssExtractPlugin());
1743+
17081744
17091745 } else {
17101746 config.mode = 'development';
@@ -1719,6 +1755,7 @@ exports[`create-webpack-app cli should use stylus in project when selected 1`] =
17191755 "description": "My webpack project",
17201756 "devDependencies": {
17211757 "css-loader": "x.x.x",
1758+ "mini-css-extract-plugin": "x.x.x",
17221759 "style-loader": "x.x.x",
17231760 "stylus": "x.x.x",
17241761 "stylus-loader": "x.x.x",
@@ -1739,11 +1776,12 @@ exports[`create-webpack-app cli should use stylus in project when selected 2`] =
17391776"// Generated using webpack-cli https://github.com/webpack/webpack-cli
17401777
17411778const path = require('path');
1779+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
17421780
17431781const isProduction = process.env.NODE_ENV === 'production';
17441782
17451783
1746- const stylesHandler = 'style-loader';
1784+ const stylesHandler =isProduction ? MiniCssExtractPlugin.loader : 'style-loader';
17471785
17481786
17491787
@@ -1778,6 +1816,8 @@ module.exports = () => {
17781816 if (isProduction) {
17791817 config.mode = 'production';
17801818
1819+ config.plugins.push(new MiniCssExtractPlugin());
1820+
17811821
17821822 } else {
17831823 config.mode = 'development';