Skip to content

Commit e44e855

Browse files
authored
fix: remove splitchunks (#2310)
1 parent a276354 commit e44e855

File tree

2 files changed

+1
-135
lines changed

2 files changed

+1
-135
lines changed

packages/generators/__tests__/__snapshots__/init-generator.test.ts.snap

Lines changed: 0 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,6 @@ Object {
1414
},
1515
],
1616
},
17-
"optimization": Object {
18-
"minimizer": Array [
19-
"new TerserPlugin()",
20-
],
21-
"splitChunks": Object {
22-
"cacheGroups": Object {
23-
"vendors": Object {
24-
"priority": -10,
25-
"test": "/[\\\\\\\\/]node_modules[\\\\\\\\/]/",
26-
},
27-
},
28-
"chunks": "'async'",
29-
"minChunks": 1,
30-
"minSize": 30000,
31-
"name": false,
32-
},
33-
},
3417
"plugins": Array [
3518
"new webpack.ProgressPlugin()",
3619
],
@@ -55,23 +38,6 @@ Object {
5538
},
5639
],
5740
},
58-
"optimization": Object {
59-
"minimizer": Array [
60-
"new TerserPlugin()",
61-
],
62-
"splitChunks": Object {
63-
"cacheGroups": Object {
64-
"vendors": Object {
65-
"priority": -10,
66-
"test": "/[\\\\\\\\/]node_modules[\\\\\\\\/]/",
67-
},
68-
},
69-
"chunks": "'async'",
70-
"minChunks": 1,
71-
"minSize": 30000,
72-
"name": false,
73-
},
74-
},
7541
"plugins": Array [
7642
"new webpack.ProgressPlugin()",
7743
],
@@ -121,23 +87,6 @@ Object {
12187
},
12288
],
12389
},
124-
"optimization": Object {
125-
"minimizer": Array [
126-
"new TerserPlugin()",
127-
],
128-
"splitChunks": Object {
129-
"cacheGroups": Object {
130-
"vendors": Object {
131-
"priority": -10,
132-
"test": "/[\\\\\\\\/]node_modules[\\\\\\\\/]/",
133-
},
134-
},
135-
"chunks": "'async'",
136-
"minChunks": 1,
137-
"minSize": 30000,
138-
"name": false,
139-
},
140-
},
14190
"plugins": Array [
14291
"new webpack.ProgressPlugin()",
14392
"new MiniCssExtractPlugin({ filename:'main.[contenthash].css' })",
@@ -166,23 +115,6 @@ Object {
166115
},
167116
],
168117
},
169-
"optimization": Object {
170-
"minimizer": Array [
171-
"new TerserPlugin()",
172-
],
173-
"splitChunks": Object {
174-
"cacheGroups": Object {
175-
"vendors": Object {
176-
"priority": -10,
177-
"test": "/[\\\\\\\\/]node_modules[\\\\\\\\/]/",
178-
},
179-
},
180-
"chunks": "'async'",
181-
"minChunks": 1,
182-
"minSize": 30000,
183-
"name": false,
184-
},
185-
},
186118
"plugins": Array [
187119
"new webpack.ProgressPlugin()",
188120
],
@@ -196,23 +128,6 @@ Object {
196128
"module": Object {
197129
"rules": Array [],
198130
},
199-
"optimization": Object {
200-
"minimizer": Array [
201-
"new TerserPlugin()",
202-
],
203-
"splitChunks": Object {
204-
"cacheGroups": Object {
205-
"vendors": Object {
206-
"priority": -10,
207-
"test": "/[\\\\\\\\/]node_modules[\\\\\\\\/]/",
208-
},
209-
},
210-
"chunks": "'async'",
211-
"minChunks": 1,
212-
"minSize": 30000,
213-
"name": false,
214-
},
215-
},
216131
"output": Object {
217132
"path": "path.resolve(__dirname, 'dist2')",
218133
},
@@ -231,14 +146,6 @@ Object {
231146
"module": Object {
232147
"rules": Array [],
233148
},
234-
"optimization": Object {
235-
"minimizer": Array [
236-
"new TerserPlugin()",
237-
],
238-
"splitChunks": Object {
239-
"chunks": "'all'",
240-
},
241-
},
242149
"plugins": Array [
243150
"new webpack.ProgressPlugin()",
244151
"new HtmlWebpackPlugin({
@@ -263,23 +170,6 @@ Object {
263170
"module": Object {
264171
"rules": Array [],
265172
},
266-
"optimization": Object {
267-
"minimizer": Array [
268-
"new TerserPlugin()",
269-
],
270-
"splitChunks": Object {
271-
"cacheGroups": Object {
272-
"vendors": Object {
273-
"priority": -10,
274-
"test": "/[\\\\\\\\/]node_modules[\\\\\\\\/]/",
275-
},
276-
},
277-
"chunks": "'async'",
278-
"minChunks": 1,
279-
"minSize": 30000,
280-
"name": false,
281-
},
282-
},
283173
"plugins": Array [
284174
"new webpack.ProgressPlugin()",
285175
],

packages/generators/src/init-generator.ts

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,7 @@ import logSymbols from 'log-symbols';
44
import path from 'path';
55
import { Confirm, Input, List } from './utils/scaffold-utils';
66

7-
import {
8-
getDefaultOptimization,
9-
LangType,
10-
langQuestionHandler,
11-
tooltip,
12-
generatePluginName,
13-
StylingType,
14-
styleQuestionHandler,
15-
entryQuestions,
16-
} from './utils';
7+
import { LangType, langQuestionHandler, tooltip, generatePluginName, StylingType, styleQuestionHandler, entryQuestions } from './utils';
178
import { CustomGenerator } from './types';
189

1910
const { logger, getPackageManager } = utils;
@@ -60,15 +51,6 @@ export default class InitGenerator extends CustomGenerator {
6051

6152
this.entryOption = './src/index.js';
6253

63-
// add splitChunks options for transparency
64-
// defaults coming from: https://webpack.js.org/plugins/split-chunks-plugin/#optimization-splitchunks
65-
this.configuration.config.topScope.push(
66-
"const path = require('path');",
67-
"const webpack = require('webpack');",
68-
'\n',
69-
tooltip.splitChunks(),
70-
);
71-
7254
(this.configuration.config.webpackOptions.plugins as string[]).push('new webpack.ProgressPlugin()');
7355
}
7456

@@ -231,12 +213,6 @@ export default class InitGenerator extends CustomGenerator {
231213
})`);
232214
}
233215

234-
// TerserPlugin
235-
this.dependencies.push('terser-webpack-plugin');
236-
this.configuration.config.topScope.push(tooltip.terser(), "const TerserPlugin = require('terser-webpack-plugin');", '\n');
237-
238-
// Chunksplitting
239-
this.configuration.config.webpackOptions.optimization = getDefaultOptimization(this.usingDefaults);
240216
this.configuration.config.webpackOptions.mode = this.usingDefaults ? "'production'" : "'development'";
241217
}
242218

0 commit comments

Comments
 (0)