@digest/webpack 3.4.2 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,12 +2,12 @@
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
- var _a;
5
+ var _a, _b;
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const os_1 = __importDefault(require("os"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const v8_1 = __importDefault(require("v8"));
10
- const scripts_1 = __importDefault(require("@digest/scripts"));
10
+ const scripts_1 = require("@digest/scripts");
11
11
  const preload_webpack_plugin_1 = __importDefault(require("@vue/preload-webpack-plugin"));
12
12
  const case_sensitive_paths_webpack_plugin_1 = __importDefault(require("case-sensitive-paths-webpack-plugin"));
13
13
  const circular_dependency_plugin_1 = __importDefault(require("circular-dependency-plugin"));
@@ -27,25 +27,37 @@ const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
27
27
  const webpack_favicons_1 = __importDefault(require("webpack-favicons"));
28
28
  const webpack_node_externals_1 = __importDefault(require("webpack-node-externals"));
29
29
  const webpack_subresource_integrity_1 = require("webpack-subresource-integrity");
30
+ const { cache } = scripts_1.config;
30
31
  let GenerateSW;
31
- if (scripts_1.default.webpackWorkbox) {
32
+ if (scripts_1.config.pwa &&
33
+ scripts_1.config.webpackWorkbox) {
32
34
  const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
33
35
  GenerateSW = WorkboxWebpackPlugin.GenerateSW;
34
36
  }
35
- let babelPolyfills;
36
- if (scripts_1.default.babelPolyfills) {
37
- babelPolyfills = require.resolve('@digest/babel-polyfills');
37
+ let babelPolyfills = null;
38
+ if (scripts_1.config.babel &&
39
+ scripts_1.config.babelPolyfills) {
40
+ babelPolyfills = require.resolve(scripts_1.config.babelPolyfills);
38
41
  }
39
- let angularPolyfills;
40
- if (scripts_1.default.webpackAngular) {
42
+ let babelPreset = null;
43
+ if (scripts_1.config.babel &&
44
+ scripts_1.config.babelPreset) {
45
+ babelPreset = require.resolve('@digest/babel-polyfills');
46
+ }
47
+ let angularPolyfills = null;
48
+ if (scripts_1.config.angular &&
49
+ scripts_1.config.webpackAngular) {
41
50
  angularPolyfills = require.resolve('@digest/angular/src/angularPolyfills.js');
42
51
  }
43
52
  let ForkTsCheckerWebpackPlugin;
44
- if (scripts_1.default.webpackTypeScript) {
53
+ if (scripts_1.config.typescript &&
54
+ scripts_1.config.webpackTypeScript) {
45
55
  ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
46
56
  }
47
57
  let ReactRefreshWebpackPlugin;
48
- if (!scripts_1.default.production && scripts_1.default.webpackReact) {
58
+ if (!scripts_1.production &&
59
+ scripts_1.config.react &&
60
+ scripts_1.config.webpackReact) {
49
61
  ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
50
62
  }
51
63
  const workers = os_1.default.cpus().length - 2 < 1 ?
@@ -61,12 +73,12 @@ const styleLoaders = (options = {}) => {
61
73
  options.camelCase = options.camelCase === undefined ?
62
74
  true :
63
75
  options.camelCase;
64
- return [].concat(scripts_1.default.production ?
76
+ return [].concat(scripts_1.production ?
65
77
  [
66
78
  {
67
79
  loader: mini_css_extract_plugin_1.default.loader,
68
80
  options: {
69
- publicPath: '../'
81
+ publicPath: './'
70
82
  }
71
83
  }
72
84
  ] :
@@ -85,9 +97,9 @@ const styleLoaders = (options = {}) => {
85
97
  exportLocalsConvention: options.camelCase ?
86
98
  'camelCase' :
87
99
  'asIs',
88
- localIdentName: scripts_1.default.library ?
89
- `${scripts_1.default.shortName}-[local]` :
90
- `[local]-[hash:${scripts_1.default.HASH_LIMIT}]`
100
+ localIdentName: scripts_1.config.library ?
101
+ `${scripts_1.config.shortName}-[local]` :
102
+ `[local]-[hash:${scripts_1.config.hashLimit}]`
91
103
  } :
92
104
  undefined,
93
105
  sourceMap: options.sourceMap
@@ -100,45 +112,36 @@ const styleLoaders = (options = {}) => {
100
112
  options: {
101
113
  postcssOptions: {
102
114
  ctx: {},
103
- path: scripts_1.default.webpackPostCSS
115
+ path: scripts_1.config.webpackPostCSS
104
116
  },
105
117
  sourceMap: options.sourceMap
106
118
  }
107
119
  }
108
120
  ] :
109
- [], options.scss ?
110
- [
111
- {
112
- loader: 'sass-loader',
113
- options: {
114
- sourceMap: options.sourceMap
115
- }
116
- }
117
- ] :
118
121
  []);
119
122
  };
120
123
  const scriptLoaders = (options = {}) => {
121
- return [].concat(scripts_1.default.parallel ?
124
+ return [].concat(scripts_1.config.parallel ?
122
125
  [
123
126
  threadLoader
124
127
  ] :
125
- [], scripts_1.default.webpackBabel ?
128
+ [], scripts_1.config.babel &&
129
+ scripts_1.config.webpackBabel ?
126
130
  [
127
131
  {
128
132
  loader: 'babel-loader',
129
133
  options: {
130
- cacheDirectory: path_1.default.join(scripts_1.default.cache, 'babel-loader'),
131
- configFile: scripts_1.default.webpackBabel,
132
- plugins: !scripts_1.default.production && scripts_1.default.babelReact ?
133
- [
134
- scripts_1.default.production && require.resolve('react-refresh/babel')
135
- ].filter(Boolean) :
136
- []
134
+ cacheDirectory: cache ?
135
+ path_1.default.join(cache, 'babel-loader') :
136
+ false,
137
+ configFile: scripts_1.config.babel
137
138
  }
138
139
  }
139
140
  ] :
140
141
  [], options.typescript ?
141
- [].concat(!scripts_1.default.production && scripts_1.default.webpackAngular ?
142
+ [].concat(!scripts_1.production &&
143
+ scripts_1.config.angular &&
144
+ scripts_1.config.webpackAngular ?
142
145
  [
143
146
  {
144
147
  loader: 'angular2-template-loader'
@@ -156,206 +159,200 @@ const scriptLoaders = (options = {}) => {
156
159
  };
157
160
  const generateName = (extension, chunkName) => {
158
161
  const hash = extension === 'css' ?
159
- `[contenthash:${scripts_1.default.HASH_LIMIT}]` :
160
- `[chunkhash:${scripts_1.default.HASH_LIMIT}]`;
161
- if (scripts_1.default.library) {
162
- if (scripts_1.default.production) {
163
- if (scripts_1.default.minimize) {
162
+ `[contenthash:${scripts_1.config.hashLimit}]` :
163
+ `[chunkhash:${scripts_1.config.hashLimit}]`;
164
+ if (scripts_1.config.library) {
165
+ if (scripts_1.production) {
166
+ if (scripts_1.config.minimize) {
164
167
  return `[name].min.${extension}`;
165
168
  }
166
169
  return `[name].${extension}`;
167
170
  }
168
171
  return `[name].${extension}`;
169
172
  }
170
- if (scripts_1.default.production) {
173
+ if (scripts_1.production) {
171
174
  return `[name].${extension}?_=${hash}`;
172
175
  }
173
176
  return `[name].${extension}`;
174
177
  };
175
178
  const configuration = {
176
- cache: {
177
- cacheDirectory: path_1.default.join(scripts_1.default.cache, 'webpack'),
178
- type: 'filesystem'
179
- },
180
- context: scripts_1.default.context,
181
- devtool: scripts_1.default.sourceMap ?
182
- scripts_1.default.production ?
179
+ cache: cache ?
180
+ {
181
+ cacheDirectory: path_1.default.join(cache, 'webpack'),
182
+ type: 'filesystem'
183
+ } :
184
+ false,
185
+ context: scripts_1.config.context,
186
+ devtool: scripts_1.config.sourceMaps ?
187
+ scripts_1.production ?
183
188
  undefined :
184
- scripts_1.default.library ?
189
+ scripts_1.config.library ?
185
190
  'source-map' :
186
191
  'inline-source-map' :
187
192
  'nosources-source-map',
188
193
  entry: {
189
- main: [].concat(scripts_1.default.production || scripts_1.default.library ?
194
+ main: [].concat(scripts_1.production || scripts_1.config.library ?
190
195
  [] :
191
196
  [
192
197
  path_1.default.join('webpack', 'hot', 'dev-server'),
193
- path_1.default.join('webpack-hot-middleware', 'client') + `?path=${path_1.default.join(scripts_1.default.baseHref)}hot`
194
- ], !scripts_1.default.library && scripts_1.default.babelPolyfills ?
198
+ path_1.default.join('webpack-hot-middleware', 'client') + `?path=${path_1.default.join(scripts_1.config.baseHref)}hot`
199
+ ], !scripts_1.config.library &&
200
+ scripts_1.config.babel &&
201
+ babelPreset ?
202
+ babelPreset :
203
+ [], !scripts_1.config.library &&
204
+ scripts_1.config.babel &&
205
+ babelPolyfills ?
195
206
  babelPolyfills :
196
- [], scripts_1.default.library || !scripts_1.default.polyfills ?
197
- [] :
198
- scripts_1.default.polyfills, !scripts_1.default.library && scripts_1.default.pwa && scripts_1.default.production ?
199
- require.resolve('@digest/webpack-workbox') :
200
- [], !scripts_1.default.library && scripts_1.default.webpackAngular ?
207
+ [], !scripts_1.config.library &&
208
+ scripts_1.config.angular &&
209
+ angularPolyfills ?
201
210
  angularPolyfills :
211
+ [], !scripts_1.config.library && scripts_1.config.pwa && scripts_1.production ?
212
+ require.resolve('@digest/webpack-workbox') :
202
213
  [], [
203
- scripts_1.default.context
214
+ scripts_1.config.context
204
215
  ])
205
216
  },
206
- externals: scripts_1.default.library ?
217
+ externals: scripts_1.config.library ?
207
218
  [
208
219
  (0, webpack_node_externals_1.default)()
209
220
  ] :
210
221
  undefined,
211
- externalsPresets: scripts_1.default.library ?
222
+ externalsPresets: scripts_1.config.library ?
212
223
  {
213
224
  node: true
214
225
  } :
215
226
  undefined,
216
- mode: scripts_1.default.production ?
227
+ mode: scripts_1.production ?
217
228
  'production' :
218
229
  'development',
219
230
  module: {
220
231
  rules: [].concat([
221
232
  {
222
233
  generator: {
223
- filename: `templates/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
234
+ filename: `templates/[name][ext]?_=[hash:${scripts_1.config.hashLimit}]`
224
235
  },
225
236
  test: /\.html$/u,
226
237
  type: 'asset/resource'
227
238
  },
228
239
  {
229
240
  generator: {
230
- filename: `icons/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
241
+ filename: `icons/[name][ext]?_=[hash:${scripts_1.config.hashLimit}]`
231
242
  },
232
243
  test: /\.ico$/u,
233
244
  type: 'asset/resource'
234
245
  },
235
246
  {
236
247
  generator: {
237
- filename: `images/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
248
+ filename: `images/[name][ext]?_=[hash:${scripts_1.config.hashLimit}]`
238
249
  },
239
250
  test: /\.(png|jpg)$/u,
240
251
  type: 'asset/resource'
241
252
  },
242
253
  {
243
254
  generator: {
244
- filename: `gifs/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
255
+ filename: `gifs/[name][ext]?_=[hash:${scripts_1.config.hashLimit}]`
245
256
  },
246
257
  test: /\.gif$/u,
247
258
  type: 'asset/resource'
248
259
  },
249
260
  {
250
261
  generator: {
251
- filename: `svg/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
262
+ filename: `svg/[name][ext]?_=[hash:${scripts_1.config.hashLimit}]`
252
263
  },
253
264
  test: /\.(svg)(\?v=\d\.\d\.\d)?$/u,
254
265
  type: 'asset/resource'
255
266
  },
256
267
  {
257
268
  generator: {
258
- filename: `fonts/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
269
+ filename: `fonts/[name][ext]?_=[hash:${scripts_1.config.hashLimit}]`
259
270
  },
260
271
  test: /\.woff(2)?(\?v=\d\.\d\.\d)?$/u,
261
272
  type: 'asset/resource'
262
273
  },
263
274
  {
264
275
  generator: {
265
- filename: `fonts/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
276
+ filename: `fonts/[name][ext]?_=[hash:${scripts_1.config.hashLimit}]`
266
277
  },
267
278
  test: /\.(ttf|eot)(\?v=\d\.\d\.\d)?$/u,
268
279
  type: 'asset/resource'
269
280
  },
270
281
  {
271
- exclude: new RegExp(`\.g\.css$|\.min\.css$|node_modules\/(?!.*(${scripts_1.default.postcssWhitelist})).*\.css$`, 'u'),
282
+ exclude: new RegExp(`\.g\.css$|\.min\.css$|node_modules\/(?!.*(${scripts_1.config.postcssWhitelist})).*\.css$`, 'u'),
272
283
  test: /\.css$/u,
273
284
  use: styleLoaders({
274
- minimize: scripts_1.default.minimize && scripts_1.default.production,
275
- modules: scripts_1.default.cssModules,
276
- postcss: Boolean(scripts_1.default.webpackPostCSS),
277
- sourceMap: scripts_1.default.sourceMap
285
+ minimize: scripts_1.config.minimize && scripts_1.production,
286
+ modules: scripts_1.config.cssModules,
287
+ postcss: Boolean(scripts_1.config.postcss &&
288
+ scripts_1.config.webpackPostCSS),
289
+ sourceMap: scripts_1.config.sourceMaps
278
290
  })
279
291
  },
280
292
  {
281
293
  test: /\.g\.css$/u,
282
294
  use: styleLoaders({
283
- minimize: scripts_1.default.minimize && scripts_1.default.production,
284
- postcss: Boolean(scripts_1.default.webpackPostCSS),
285
- sourceMap: scripts_1.default.sourceMap
295
+ minimize: scripts_1.config.minimize && scripts_1.production,
296
+ postcss: Boolean(scripts_1.config.postcss &&
297
+ scripts_1.config.webpackPostCSS),
298
+ sourceMap: scripts_1.config.sourceMaps
286
299
  })
287
300
  },
288
301
  {
289
- test: new RegExp(`\.min\.css$|node_modules\/(?!.*(${scripts_1.default.postcssWhitelist})).*\.css$`, 'u'),
302
+ test: new RegExp(`\.min\.css$|node_modules\/(?!.*(${scripts_1.config.postcssWhitelist})).*\.css$`, 'u'),
290
303
  use: styleLoaders({
291
304
  camelCase: false,
292
305
  minimize: false
293
306
  })
294
307
  },
295
308
  {
296
- exclude: scripts_1.default.ignore,
309
+ exclude: /(node_modules|lib|dist)[\\/\\\\]/u,
297
310
  test: /\.js$/u,
298
311
  use: scriptLoaders()
299
312
  },
300
313
  {
301
- exclude: scripts_1.default.ignore,
314
+ exclude: /(node_modules|lib|dist)[\\/\\\\]/u,
302
315
  test: /\.mjs$/u,
303
316
  use: scriptLoaders()
304
317
  }
305
- ], scripts_1.default.webpackSCSS ?
306
- [
307
- {
308
- exclude: new RegExp(`\.g\.(scss|sass)$|\.min\.(scss|sass)$|node_modules\/(?!.*(${scripts_1.default.postcssWhitelist})).*\.(scss|sass)$`, 'u'),
309
- test: /\.(scss|sass)$/u,
310
- use: styleLoaders({
311
- minimize: scripts_1.default.minimize && scripts_1.default.production,
312
- modules: scripts_1.default.cssModules,
313
- scss: scripts_1.default.webpackSCSS,
314
- sourceMap: scripts_1.default.sourceMap
315
- })
316
- },
317
- {
318
- test: /\.g\.(scss|sass)$/u,
319
- use: styleLoaders({
320
- minimize: scripts_1.default.minimize && scripts_1.default.production,
321
- postcss: Boolean(scripts_1.default.webpackPostCSS),
322
- scss: scripts_1.default.webpackSCSS,
323
- sourceMap: scripts_1.default.sourceMap
324
- })
325
- }
326
- ] :
327
- [], scripts_1.default.webpackReact ?
318
+ ], scripts_1.config.react &&
319
+ scripts_1.config.webpackReact ?
328
320
  [
329
321
  {
330
- exclude: scripts_1.default.ignore,
322
+ exclude: /(node_modules|lib|dist)[\\/\\\\]/u,
331
323
  test: /\.jsx$/u,
332
324
  use: scriptLoaders({
333
- react: scripts_1.default.webpackReact
325
+ react: true
334
326
  })
335
327
  }
336
328
  ] :
337
- [], scripts_1.default.webpackTypeScript ?
329
+ [], scripts_1.config.typescript &&
330
+ scripts_1.config.webpackTypeScript ?
338
331
  [
339
332
  {
340
- exclude: scripts_1.default.ignore,
333
+ exclude: /(node_modules|lib|dist)[\\/\\\\]/u,
341
334
  test: /\.ts$/u,
342
335
  use: scriptLoaders({
343
- typescript: Boolean(scripts_1.default.webpackTypeScript)
336
+ typescript: true
344
337
  })
345
338
  }
346
339
  ] :
347
- [], scripts_1.default.webpackReact && scripts_1.default.webpackTypeScript ?
340
+ [], scripts_1.config.react &&
341
+ scripts_1.config.webpackReact &&
342
+ scripts_1.config.typescript &&
343
+ scripts_1.config.webpackTypeScript ?
348
344
  [
349
345
  {
350
- exclude: scripts_1.default.ignore,
346
+ exclude: /(node_modules|lib|dist)[\\/\\\\]/u,
351
347
  test: /\.tsx$/u,
352
348
  use: scriptLoaders({
353
- react: scripts_1.default.webpackReact,
354
- typescript: Boolean(scripts_1.default.webpackTypeScript)
349
+ react: true,
350
+ typescript: true
355
351
  })
356
352
  }
357
353
  ] :
358
- [], scripts_1.default.webpackGraphQL ?
354
+ [], scripts_1.config.graphql &&
355
+ scripts_1.config.webpackGraphQL ?
359
356
  [
360
357
  {
361
358
  exclude: /node_modules/u,
@@ -370,11 +367,11 @@ const configuration = {
370
367
  [])
371
368
  },
372
369
  optimization: {
373
- minimize: scripts_1.default.minimize && scripts_1.default.production,
370
+ minimize: scripts_1.config.minimize && scripts_1.production,
374
371
  minimizer: [
375
372
  new terser_webpack_plugin_1.default({
376
373
  extractComments: false,
377
- parallel: scripts_1.default.parallel,
374
+ parallel: scripts_1.config.parallel,
378
375
  terserOptions: {
379
376
  compress: true,
380
377
  ecma: undefined,
@@ -388,7 +385,7 @@ const configuration = {
388
385
  comments: false
389
386
  },
390
387
  safari10: false,
391
- sourceMap: scripts_1.default.sourceMap,
388
+ sourceMap: scripts_1.config.sourceMaps,
392
389
  toplevel: true
393
390
  }
394
391
  }),
@@ -404,31 +401,31 @@ const configuration = {
404
401
  }
405
402
  ]
406
403
  },
407
- parallel: scripts_1.default.parallel,
404
+ parallel: scripts_1.config.parallel,
408
405
  warningsFilter: () => {
409
406
  return true;
410
407
  }
411
408
  })
412
409
  ],
413
- moduleIds: scripts_1.default.production ?
410
+ moduleIds: scripts_1.production ?
414
411
  undefined :
415
412
  'named',
416
413
  providedExports: false,
417
- runtimeChunk: scripts_1.default.library ?
414
+ runtimeChunk: scripts_1.config.library ?
418
415
  false :
419
416
  {
420
417
  name: (entrypoint) => {
421
418
  return `runtime.${entrypoint.name}`;
422
419
  }
423
420
  },
424
- splitChunks: scripts_1.default.library ?
421
+ splitChunks: scripts_1.config.library ?
425
422
  {} :
426
423
  {
427
424
  chunks: 'all'
428
425
  }
429
426
  },
430
427
  output: {
431
- chunkFilename: scripts_1.default.library ?
428
+ chunkFilename: scripts_1.config.library ?
432
429
  path_1.default.join(generateName('js')) :
433
430
  path_1.default.join('scripts', 'chunks', generateName('js')),
434
431
  crossOriginLoading: 'anonymous',
@@ -436,16 +433,18 @@ const configuration = {
436
433
  return `file://${path_1.default.resolve(info.absoluteResourcePath).replace('\\', '/')}`;
437
434
  },
438
435
  filename: (chunkData) => {
439
- return scripts_1.default.library ?
436
+ return scripts_1.config.library ?
440
437
  path_1.default.join(generateName('js', chunkData)) :
441
438
  path_1.default.join('scripts', generateName('js', chunkData));
442
439
  },
443
- library: scripts_1.default.library ?
440
+ library: scripts_1.config.library ?
444
441
  'index' :
445
442
  undefined,
446
443
  libraryTarget: 'umd',
447
- path: scripts_1.default.staticPath,
448
- publicPath: scripts_1.default.library ?
444
+ path: path_1.default.resolve(scripts_1.config.staticPath, scripts_1.config.library ?
445
+ '' :
446
+ 'bundle'),
447
+ publicPath: scripts_1.config.library ?
449
448
  './' :
450
449
  './bundle/',
451
450
  umdNamedDefine: true
@@ -469,36 +468,37 @@ const configuration = {
469
468
  new webpack_1.DefinePlugin({
470
469
  'process.env': Object.assign(Object.assign({ BUILD: {
471
470
  DATE: JSON.stringify(new Date().toString())
472
- }, NODE_ENV: JSON.stringify(scripts_1.default.production ?
471
+ }, NODE_ENV: JSON.stringify(scripts_1.production ?
473
472
  'production' :
474
- 'development') }, scripts_1.default.library ?
473
+ 'development') }, scripts_1.config.library ?
475
474
  undefined :
476
475
  {
477
476
  PACKAGE: {
478
- DESCRIPTION: JSON.stringify(scripts_1.default.project.description),
479
- NAME: JSON.stringify(scripts_1.default.project.name),
480
- TITLE: JSON.stringify(scripts_1.default.project.title),
481
- VERSION: JSON.stringify(scripts_1.default.project.version)
477
+ DESCRIPTION: JSON.stringify(scripts_1.package.description),
478
+ NAME: JSON.stringify(scripts_1.package.name),
479
+ TITLE: JSON.stringify(scripts_1.package.title),
480
+ VERSION: JSON.stringify(scripts_1.package.version)
482
481
  }
483
- }), scripts_1.default.env)
482
+ }), scripts_1.config.env)
484
483
  })
485
- ].concat(scripts_1.default.webpackESLint ?
484
+ ].concat(scripts_1.config.eslint &&
485
+ scripts_1.config.webpackESLint ?
486
486
  [
487
487
  new eslint_webpack_plugin_1.default({
488
- failOnError: scripts_1.default.production,
489
- failOnWarning: scripts_1.default.production,
488
+ failOnError: scripts_1.production,
489
+ failOnWarning: scripts_1.production,
490
490
  formatter: 'eslint-formatter-friendly',
491
- overrideConfigFile: scripts_1.default.webpackESLint
491
+ overrideConfigFile: scripts_1.config.eslint
492
492
  })
493
493
  ] :
494
- [], scripts_1.default.production ?
494
+ [], scripts_1.production ?
495
495
  [
496
496
  new webpack_1.optimize.ModuleConcatenationPlugin(),
497
497
  new mini_css_extract_plugin_1.default({
498
- chunkFilename: scripts_1.default.library ?
498
+ chunkFilename: scripts_1.config.library ?
499
499
  path_1.default.join(generateName('css')) :
500
500
  path_1.default.join('styles', 'chunks', generateName('css')),
501
- filename: scripts_1.default.library ?
501
+ filename: scripts_1.config.library ?
502
502
  path_1.default.join(generateName('css')) :
503
503
  path_1.default.join('styles', generateName('css'))
504
504
  }),
@@ -507,42 +507,51 @@ const configuration = {
507
507
  generateStatsFile: true,
508
508
  logLevel: 'silent',
509
509
  openAnalyzer: false,
510
- reportFilename: path_1.default.join(scripts_1.default.reportPath, 'webpack', 'index.html'),
511
- statsFilename: path_1.default.join(scripts_1.default.reportPath, 'webpack', 'index.json'),
510
+ reportFilename: scripts_1.config.reports ?
511
+ path_1.default.resolve(scripts_1.config.reports, 'webpack', 'index.html') :
512
+ undefined,
513
+ statsFilename: scripts_1.config.reports ?
514
+ path_1.default.resolve(scripts_1.config.reports, 'webpack', 'index.json') :
515
+ undefined,
512
516
  statsOptions: {
513
- publicPath: !scripts_1.default.production
517
+ publicPath: !scripts_1.production
514
518
  }
515
519
  })
516
520
  ] :
517
521
  [
518
522
  new clean_webpack_plugin_1.CleanWebpackPlugin(),
519
523
  new webpack_1.HotModuleReplacementPlugin()
520
- ], !scripts_1.default.production && scripts_1.default.webpackReact ?
524
+ ], !scripts_1.production &&
525
+ scripts_1.config.react &&
526
+ scripts_1.config.webpackReact ?
521
527
  [
522
528
  new ReactRefreshWebpackPlugin()
523
529
  ] :
524
- [], scripts_1.default.production ?
530
+ [], scripts_1.production ?
525
531
  [] :
526
532
  [
527
533
  new webpack_1.NoEmitOnErrorsPlugin()
528
- ], scripts_1.default.webpackTypeScript && scripts_1.default.parallel ?
534
+ ], scripts_1.config.typescript &&
535
+ scripts_1.config.webpackTypeScript &&
536
+ scripts_1.config.parallel ?
529
537
  [
530
538
  new ForkTsCheckerWebpackPlugin({
531
539
  typescript: {
532
- configFile: scripts_1.default.webpackTypeScript,
540
+ configFile: scripts_1.config.typescript,
533
541
  memoryLimit: Math.floor(v8_1.default.getHeapStatistics().heap_size_limit / 1000000)
534
542
  }
535
543
  })
536
544
  ] :
537
- [], scripts_1.default.library ?
538
- [] :
545
+ [], scripts_1.config.indexHtml && !scripts_1.config.library ?
539
546
  [
540
547
  new html_webpack_plugin_1.default({
541
548
  alwaysWriteToDisk: true,
542
- baseHref: scripts_1.default.baseHref.replace(/\/?$/u, '/'),
549
+ baseHref: scripts_1.config.baseHref ?
550
+ scripts_1.config.baseHref.replace(/\/?$/u, '/') :
551
+ '/',
543
552
  filename: path_1.default.join('..', 'index.html'),
544
553
  inject: 'body',
545
- minify: scripts_1.default.production ?
554
+ minify: scripts_1.production ?
546
555
  {
547
556
  collapseWhitespace: false,
548
557
  includeAutoGeneratedTags: true,
@@ -558,23 +567,27 @@ const configuration = {
558
567
  } :
559
568
  {},
560
569
  scriptLoading: 'defer',
561
- template: (_a = scripts_1.default.resolve('index.htm', scripts_1.default.index)) !== null && _a !== void 0 ? _a : undefined,
562
- title: scripts_1.default.project.title,
563
- version: scripts_1.default.project.version
564
- }),
570
+ template: scripts_1.config.indexHtml,
571
+ title: scripts_1.package.title,
572
+ version: scripts_1.package.version
573
+ })
574
+ ] :
575
+ [], scripts_1.config.library ?
576
+ [] :
577
+ [
565
578
  new preload_webpack_plugin_1.default(),
566
579
  new html_webpack_harddisk_plugin_1.default()
567
- ], scripts_1.default.production && !scripts_1.default.library ?
580
+ ], scripts_1.production && !scripts_1.config.library ?
568
581
  [
569
582
  new webpack_subresource_integrity_1.SubresourceIntegrityPlugin({
570
- enabled: scripts_1.default.production
583
+ enabled: scripts_1.production
571
584
  }),
572
585
  new webpack_favicons_1.default({
573
- appDescription: scripts_1.default.project.description,
574
- appName: scripts_1.default.project.title,
586
+ appDescription: scripts_1.package.description,
587
+ appName: scripts_1.package.title,
575
588
  background: '#fff',
576
- developerName: scripts_1.default.project.author.name,
577
- developerURL: scripts_1.default.project.author.url,
589
+ developerName: (_a = scripts_1.package.author) === null || _a === void 0 ? void 0 : _a.name,
590
+ developerURL: (_b = scripts_1.package.author) === null || _b === void 0 ? void 0 : _b.url,
578
591
  display: 'standalone',
579
592
  icons: {
580
593
  android: true,
@@ -589,14 +602,14 @@ const configuration = {
589
602
  manifestRelativePaths: true,
590
603
  orientation: 'portrait',
591
604
  path: path_1.default.join('favicons', '/'),
592
- src: scripts_1.default.favicon,
593
- start_url: scripts_1.default.baseHref,
605
+ src: scripts_1.config.favicon,
606
+ start_url: scripts_1.config.baseHref,
594
607
  theme_color: '#fff',
595
- version: scripts_1.default.project.version
608
+ version: scripts_1.package.version
596
609
  }),
597
610
  new html_webpack_link_type_plugin_1.HtmlWebpackLinkTypePlugin()
598
611
  ] :
599
- [], scripts_1.default.compression && scripts_1.default.production && !scripts_1.default.library ?
612
+ [], scripts_1.config.compression && scripts_1.production && !scripts_1.config.library ?
600
613
  [
601
614
  new compression_webpack_plugin_1.default({
602
615
  algorithm: 'gzip',
@@ -608,10 +621,10 @@ const configuration = {
608
621
  threshold: 0
609
622
  })
610
623
  ] :
611
- [], scripts_1.default.webpackWorkbox && scripts_1.default.production && !scripts_1.default.library ?
624
+ [], scripts_1.config.webpackWorkbox && scripts_1.production && !scripts_1.config.library ?
612
625
  [
613
626
  new GenerateSW({
614
- cacheId: scripts_1.default.shortName,
627
+ cacheId: scripts_1.config.shortName,
615
628
  clientsClaim: false,
616
629
  directoryIndex: 'index.html',
617
630
  exclude: [
@@ -623,18 +636,14 @@ const configuration = {
623
636
  /\.js($|\?\w+$)/u
624
637
  ],
625
638
  modifyURLPrefix: {
626
- bundle: path_1.default.join('..')
639
+ bundle: path_1.default.join('.')
627
640
  },
628
- navigateFallback: `${scripts_1.default.baseHref}index.html`,
641
+ navigateFallback: `${scripts_1.config.baseHref}index.html`,
629
642
  navigateFallbackDenylist: [].concat([
630
643
  /\/bundle\//u,
631
644
  /^\/_/u,
632
645
  /\/[^/]+\\.[^/]+$/u
633
- ], scripts_1.default.fallbackDenyList ?
634
- [
635
- scripts_1.default.fallbackDenyList
636
- ] :
637
- []),
646
+ ]),
638
647
  runtimeCaching: [
639
648
  {
640
649
  handler: 'CacheFirst',
@@ -666,7 +675,7 @@ const configuration = {
666
675
  ]
667
676
  },
668
677
  stats: 'minimal',
669
- target: scripts_1.default.library ?
678
+ target: scripts_1.config.library ?
670
679
  [
671
680
  'node'
672
681
  ] :