@@ -6,10 +6,11 @@ import * as path from "path";
66import { getPackageManager } from "@webpack-cli/utils/package-manager" ;
77import { Confirm , Input , List } from "@webpack-cli/webpack-scaffold" ;
88
9+ import { getDefaultOptimization } from "./utils/webpackConfig" ;
910import { WebpackOptions } from "./types" ;
1011import entryQuestions from "./utils/entry" ;
11- import langQuestionHandler , { LangType } from "./utils/language " ;
12- import styleQuestionHandler , { Loader , StylingType } from "./utils/style " ;
12+ import langQuestionHandler , { LangType } from "./utils/languageSupport " ;
13+ import styleQuestionHandler , { Loader , StylingType } from "./utils/styleSupport " ;
1314import tooltip from "./utils/tooltip" ;
1415
1516/**
@@ -87,36 +88,8 @@ export default class InitGenerator extends Generator {
8788 "new webpack.ProgressPlugin()" ,
8889 ) ;
8990
90- let optimizationObj ;
91-
92- if ( ! this . isProd ) {
93- optimizationObj = {
94- splitChunks : {
95- chunks : "'all'" ,
96- } ,
97- } ;
98- } else {
99- optimizationObj = {
100- minimizer : [
101- "new TerserPlugin()" ,
102- ] ,
103- splitChunks : {
104- cacheGroups : {
105- vendors : {
106- priority : - 10 ,
107- test : "/[\\\\/]node_modules[\\\\/]/" ,
108- } ,
109- } ,
110- chunks : "'async'" ,
111- minChunks : 1 ,
112- minSize : 30000 ,
113- // for production name is recommended to be off
114- name : ! this . isProd ,
115- } ,
116- } ;
117- }
118-
119- this . configuration . config . webpackOptions . optimization = optimizationObj ;
91+ let optimizationConfig = getDefaultOptimization ( this . isProd ) ;
92+ this . configuration . config . webpackOptions . optimization = optimizationConfig ;
12093
12194 if ( ! this . isProd ) {
12295 this . configuration . config . webpackOptions . devServer = {
0 commit comments