8
8
9
9
const canonicalJson = require ( 'canonical-json' ) ;
10
10
const fs = require ( 'fs' ) ;
11
- const ManifestPlugin = require ( 'webpack-manifest-plugin' ) ;
12
11
const path = require ( 'path' ) ;
13
12
const shell = require ( 'shelljs' ) ;
14
13
const shellQuote = require ( 'shell-quote' ) ;
15
14
const TerserPlugin = require ( 'terser-webpack-plugin' ) ;
16
15
const webpack = require ( 'webpack' ) ;
17
16
18
- const poFile = require ( './root/server/gettext/poFile' ) ;
19
- const browserConfig = require ( './webpack/browserConfig' ) ;
17
+ const poFile = require ( '../root/server/gettext/poFile' ) ;
18
+ const { cloneObjectDeep} =
19
+ require ( '../root/static/scripts/common/utility/cloneDeep' ) ;
20
+ const jedDataTemplate = require ( '../root/static/scripts/jed-data' ) ;
21
+
22
+ const browserConfig = require ( './browserConfig' ) ;
23
+ const cacheConfig = require ( './cacheConfig' ) ;
20
24
const {
21
25
dirs,
22
26
GETTEXT_DOMAINS ,
23
27
PRODUCTION_MODE ,
24
28
WEBPACK_MODE ,
25
- } = require ( './webpack/constants' ) ;
26
- const moduleConfig = require ( './webpack/moduleConfig' ) ;
27
- const providePluginConfig = require ( './webpack/providePluginConfig' ) ;
28
- const { cloneObjectDeep} =
29
- require ( './root/static/scripts/common/utility/cloneDeep' ) ;
30
- const jedDataTemplate = require ( './root/static/scripts/jed-data' ) ;
29
+ } = require ( './constants' ) ;
30
+ const moduleConfig = require ( './moduleConfig' ) ;
31
+ const providePluginConfig = require ( './providePluginConfig' ) ;
31
32
32
33
const entries = [
33
34
'account/applications/register' ,
@@ -212,19 +213,23 @@ plugins.push(new webpack.ProvidePlugin(providePluginConfig));
212
213
213
214
if ( PRODUCTION_MODE ) {
214
215
plugins . push (
215
- new webpack . HashedModuleIdsPlugin ( {
216
+ new webpack . ids . HashedModuleIdsPlugin ( {
216
217
hashDigestLength : 7 ,
217
218
} ) ,
218
219
) ;
219
220
}
220
221
221
- plugins . push . apply ( plugins , [
222
- new ManifestPlugin ( {
223
- fileName : 'rev-manifest.json' ,
224
- } ) ,
225
- ] ) ;
222
+ if ( String ( process . env . NO_PROGRESS ) !== '1' ) {
223
+ plugins . push (
224
+ new webpack . ProgressPlugin ( {
225
+ activeModules : true ,
226
+ } ) ,
227
+ ) ;
228
+ }
226
229
227
230
module . exports = {
231
+ cache : cacheConfig ,
232
+
228
233
context : dirs . CHECKOUT ,
229
234
230
235
devtool : 'source-map' ,
@@ -235,10 +240,13 @@ module.exports = {
235
240
236
241
module : moduleConfig ,
237
242
238
- node : browserConfig . node ,
243
+ name : 'client-bundles' ,
244
+
245
+ node : false ,
239
246
240
247
optimization : {
241
248
runtimeChunk : 'single' ,
249
+
242
250
splitChunks : {
243
251
cacheGroups : {
244
252
'common-chunks' : {
@@ -250,6 +258,16 @@ module.exports = {
250
258
} ,
251
259
} ,
252
260
} ,
261
+
262
+ ...( PRODUCTION_MODE ? {
263
+ minimizer : [
264
+ new TerserPlugin ( {
265
+ terserOptions : {
266
+ safari10 : true ,
267
+ } ,
268
+ } ) ,
269
+ ] ,
270
+ } : null ) ,
253
271
} ,
254
272
255
273
output : {
@@ -265,18 +283,3 @@ module.exports = {
265
283
266
284
resolve : browserConfig . resolve ,
267
285
} ;
268
-
269
- if ( String ( process . env . WATCH_MODE ) === '1' ) {
270
- Object . assign ( module . exports , require ( './webpack/watchConfig' ) ) ;
271
- }
272
-
273
- if ( PRODUCTION_MODE ) {
274
- module . exports . optimization . minimizer = [
275
- new TerserPlugin ( {
276
- sourceMap : true ,
277
- terserOptions : {
278
- safari10 : true ,
279
- } ,
280
- } ) ,
281
- ] ;
282
- }
0 commit comments