@digest/webpack 4.14.5 → 4.14.8-next.1

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.
@@ -0,0 +1,6 @@
1
+ import type configuration from './webpack.config';
2
+ type Loader = typeof configuration.loader;
3
+ declare const scriptLoaders: (options?: {
4
+ typescript?: boolean;
5
+ }) => Loader[];
6
+ export default scriptLoaders;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const threadLoader_1 = __importDefault(require("./threadLoader"));
7
+ const scripts_1 = require("@digest/scripts");
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ const { cache } = scripts_1.config;
10
+ const scriptLoaders = (options = {}) => {
11
+ return [].concat(scripts_1.config.parallel ?
12
+ [
13
+ threadLoader_1.default
14
+ ] :
15
+ [], scripts_1.config.babel &&
16
+ scripts_1.config.webpackBabel ?
17
+ [
18
+ {
19
+ loader: 'babel-loader',
20
+ options: {
21
+ cacheDirectory: cache ?
22
+ node_path_1.default.join(cache, 'babel-loader') :
23
+ false,
24
+ configFile: scripts_1.config.babel
25
+ }
26
+ }
27
+ ] :
28
+ [], options.typescript ?
29
+ [].concat(!scripts_1.production &&
30
+ scripts_1.config.angular &&
31
+ scripts_1.config.webpackAngular ?
32
+ [
33
+ {
34
+ loader: 'angular2-template-loader'
35
+ },
36
+ {
37
+ loader: '@angularclass/hmr-loader'
38
+ }
39
+ ] :
40
+ []) :
41
+ [], [
42
+ {
43
+ loader: 'source-map-loader'
44
+ }
45
+ ]);
46
+ };
47
+ exports.default = scriptLoaders;
@@ -0,0 +1,11 @@
1
+ import type configuration from './webpack.config';
2
+ type Loader = typeof configuration.loader;
3
+ declare const styleLoaders: (options?: {
4
+ camelCase?: boolean;
5
+ minimize?: boolean;
6
+ modules?: boolean;
7
+ postcss?: boolean;
8
+ production?: boolean;
9
+ sourceMap?: boolean;
10
+ }) => Loader[];
11
+ export default styleLoaders;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const threadLoader_1 = __importDefault(require("./threadLoader"));
7
+ const scripts_1 = require("@digest/scripts");
8
+ const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
9
+ const styleLoaders = (options = {}) => {
10
+ options.camelCase = options.camelCase === undefined ?
11
+ true :
12
+ options.camelCase;
13
+ return [].concat(scripts_1.production ?
14
+ [
15
+ {
16
+ loader: mini_css_extract_plugin_1.default.loader,
17
+ options: {
18
+ publicPath: '../'
19
+ }
20
+ }
21
+ ] :
22
+ [
23
+ threadLoader_1.default,
24
+ {
25
+ loader: 'style-loader'
26
+ }
27
+ ], [
28
+ {
29
+ loader: 'css-loader',
30
+ options: {
31
+ importLoaders: 1,
32
+ modules: options.modules ?
33
+ {
34
+ exportLocalsConvention: options.camelCase ?
35
+ 'camelCase' :
36
+ 'asIs',
37
+ localIdentName: scripts_1.config.library ?
38
+ `${scripts_1.config.shortName}-[local]` :
39
+ `[local]-[hash:${scripts_1.config.hashLimit}]`
40
+ } :
41
+ undefined,
42
+ sourceMap: options.sourceMap
43
+ }
44
+ }
45
+ ], options.postcss ?
46
+ [
47
+ {
48
+ loader: 'postcss-loader',
49
+ options: {
50
+ postcssOptions: {
51
+ ctx: {},
52
+ path: scripts_1.config.webpackPostCSS
53
+ },
54
+ sourceMap: options.sourceMap
55
+ }
56
+ }
57
+ ] :
58
+ []);
59
+ };
60
+ exports.default = styleLoaders;
@@ -0,0 +1,7 @@
1
+ declare const threadLoader: {
2
+ loader: string;
3
+ options: {
4
+ workers: number;
5
+ };
6
+ };
7
+ export default threadLoader;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_os_1 = __importDefault(require("node:os"));
7
+ const workers = node_os_1.default.cpus().length - 2 < 1 ?
8
+ 1 :
9
+ node_os_1.default.cpus().length - 2;
10
+ const threadLoader = {
11
+ loader: 'thread-loader',
12
+ options: {
13
+ workers
14
+ }
15
+ };
16
+ exports.default = threadLoader;
@@ -0,0 +1,3 @@
1
+ import { type Configuration } from 'webpack';
2
+ declare const configuration: Configuration;
3
+ export default configuration;
@@ -0,0 +1,617 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ var _a, _b;
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const scriptLoaders_1 = __importDefault(require("./scriptLoaders"));
8
+ const styleLoaders_1 = __importDefault(require("./styleLoaders"));
9
+ const scripts_1 = require("@digest/scripts");
10
+ const preload_webpack_plugin_1 = __importDefault(require("@vue/preload-webpack-plugin"));
11
+ const case_sensitive_paths_webpack_plugin_1 = __importDefault(require("case-sensitive-paths-webpack-plugin"));
12
+ const circular_dependency_plugin_1 = __importDefault(require("circular-dependency-plugin"));
13
+ const clean_terminal_webpack_plugin_1 = __importDefault(require("clean-terminal-webpack-plugin"));
14
+ const clean_webpack_plugin_1 = require("clean-webpack-plugin");
15
+ const compression_webpack_plugin_1 = __importDefault(require("compression-webpack-plugin"));
16
+ const css_minimizer_webpack_plugin_1 = __importDefault(require("css-minimizer-webpack-plugin"));
17
+ const duplicate_package_checker_webpack_plugin_1 = __importDefault(require("duplicate-package-checker-webpack-plugin"));
18
+ const html_webpack_harddisk_plugin_1 = __importDefault(require("html-webpack-harddisk-plugin"));
19
+ const html_webpack_link_type_plugin_1 = require("html-webpack-link-type-plugin");
20
+ const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
21
+ const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
22
+ const node_path_1 = __importDefault(require("node:path"));
23
+ const node_v8_1 = __importDefault(require("node:v8"));
24
+ const terser_webpack_plugin_1 = __importDefault(require("terser-webpack-plugin"));
25
+ const webpack_1 = require("webpack");
26
+ const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
27
+ const webpack_favicons_1 = __importDefault(require("webpack-favicons"));
28
+ const webpack_node_externals_1 = __importDefault(require("webpack-node-externals"));
29
+ const webpack_subresource_integrity_1 = require("webpack-subresource-integrity");
30
+ const { cache } = scripts_1.config;
31
+ let GenerateSW;
32
+ let WorkboxEntry;
33
+ if (!scripts_1.config.library &&
34
+ scripts_1.config.pwa &&
35
+ scripts_1.config.webpackWorkbox) {
36
+ const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
37
+ GenerateSW = WorkboxWebpackPlugin.GenerateSW;
38
+ WorkboxEntry = require.resolve('@digest/webpack-workbox');
39
+ }
40
+ let babelPolyfills = null;
41
+ if (scripts_1.config.babel &&
42
+ scripts_1.config.babelPolyfills) {
43
+ babelPolyfills = require.resolve(scripts_1.config.babelPolyfills);
44
+ }
45
+ let ESLintPlugin;
46
+ if (scripts_1.config.eslint &&
47
+ scripts_1.config.webpackESLint) {
48
+ ESLintPlugin = require('eslint-webpack-plugin');
49
+ }
50
+ let angularPolyfills = null;
51
+ if (scripts_1.config.angular &&
52
+ scripts_1.config.webpackAngular) {
53
+ angularPolyfills = require.resolve('@digest/angular/src/angularPolyfills.js');
54
+ }
55
+ let ForkTsCheckerWebpackPlugin;
56
+ if (scripts_1.config.typescript &&
57
+ scripts_1.config.webpackTypeScript) {
58
+ ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
59
+ }
60
+ let ReactRefreshWebpackPlugin;
61
+ if (!scripts_1.production &&
62
+ scripts_1.config.react &&
63
+ scripts_1.config.webpackReact) {
64
+ ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
65
+ }
66
+ const generateName = (extension, chunkName) => {
67
+ const hash = extension === 'css' ?
68
+ `[contenthash:${scripts_1.config.hashLimit}]` :
69
+ `[chunkhash:${scripts_1.config.hashLimit}]`;
70
+ if (scripts_1.config.library) {
71
+ if (scripts_1.production) {
72
+ if (scripts_1.config.minimize) {
73
+ return `[name].min.${extension}`;
74
+ }
75
+ return `[name].${extension}`;
76
+ }
77
+ return `[name].${extension}`;
78
+ }
79
+ if (scripts_1.production) {
80
+ return `[name].${extension}?_=${hash}`;
81
+ }
82
+ return `[name].${extension}`;
83
+ };
84
+ const baseHrefHtml = scripts_1.config.baseHrefHtml ?
85
+ scripts_1.config.baseHrefHtml.replace(/\/?$/u, '/') :
86
+ (scripts_1.config.baseHref ?
87
+ scripts_1.config.baseHref.replace(/\/?$/u, '/') :
88
+ undefined);
89
+ const configuration = {
90
+ cache: cache ?
91
+ {
92
+ cacheDirectory: node_path_1.default.join(cache, 'webpack', scripts_1.config.reactNative && scripts_1.config.webpackReactNative ?
93
+ 'native' :
94
+ 'web'),
95
+ type: 'filesystem'
96
+ } :
97
+ false,
98
+ context: scripts_1.config.context,
99
+ devtool: scripts_1.config.sourceMaps ?
100
+ scripts_1.production ?
101
+ undefined :
102
+ scripts_1.config.library ?
103
+ 'source-map' :
104
+ 'inline-source-map' :
105
+ 'nosources-source-map',
106
+ entry: {
107
+ main: [].concat(scripts_1.production || scripts_1.config.library ?
108
+ [] :
109
+ [
110
+ node_path_1.default.join('webpack', 'hot', 'dev-server'),
111
+ node_path_1.default.join('webpack-hot-middleware', 'client') + `?path=${node_path_1.default.join(baseHrefHtml !== null && baseHrefHtml !== void 0 ? baseHrefHtml : '/')}hot`
112
+ ], !scripts_1.config.library &&
113
+ scripts_1.config.babel &&
114
+ babelPolyfills ?
115
+ babelPolyfills :
116
+ [], !scripts_1.config.library &&
117
+ scripts_1.config.angular &&
118
+ angularPolyfills ?
119
+ angularPolyfills :
120
+ [], !scripts_1.config.library && WorkboxEntry && scripts_1.production ?
121
+ WorkboxEntry :
122
+ [], [
123
+ scripts_1.config.context
124
+ ])
125
+ },
126
+ externals: scripts_1.config.library ?
127
+ [
128
+ (0, webpack_node_externals_1.default)()
129
+ ] :
130
+ undefined,
131
+ externalsPresets: scripts_1.config.library ?
132
+ {
133
+ node: true
134
+ } :
135
+ undefined,
136
+ mode: scripts_1.production ?
137
+ 'production' :
138
+ 'development',
139
+ module: {
140
+ rules: [].concat([
141
+ {
142
+ generator: {
143
+ filename: `templates/[name][ext]?_=[hash:${scripts_1.config.hashLimit}]`
144
+ },
145
+ test: /\.html$/u,
146
+ type: 'asset/resource'
147
+ },
148
+ {
149
+ generator: {
150
+ filename: `icons/[name][ext]?_=[hash:${scripts_1.config.hashLimit}]`
151
+ },
152
+ test: /\.ico$/u,
153
+ type: 'asset/resource'
154
+ },
155
+ {
156
+ generator: {
157
+ filename: `images/[name][ext]?_=[hash:${scripts_1.config.hashLimit}]`
158
+ },
159
+ test: /\.(png|jpg)$/u,
160
+ type: 'asset/resource'
161
+ },
162
+ {
163
+ generator: {
164
+ filename: `gifs/[name][ext]?_=[hash:${scripts_1.config.hashLimit}]`
165
+ },
166
+ test: /\.gif$/u,
167
+ type: 'asset/resource'
168
+ },
169
+ {
170
+ generator: {
171
+ filename: `svg/[name][ext]?_=[hash:${scripts_1.config.hashLimit}]`
172
+ },
173
+ test: /\.(svg)(\?v=\d\.\d\.\d)?$/u,
174
+ type: 'asset/resource'
175
+ },
176
+ {
177
+ generator: {
178
+ filename: `fonts/[name][ext]?_=[hash:${scripts_1.config.hashLimit}]`
179
+ },
180
+ test: /\.woff(2)?(\?v=\d\.\d\.\d)?$/u,
181
+ type: 'asset/resource'
182
+ },
183
+ {
184
+ generator: {
185
+ filename: `fonts/[name][ext]?_=[hash:${scripts_1.config.hashLimit}]`
186
+ },
187
+ test: /\.(ttf|eot)(\?v=\d\.\d\.\d)?$/u,
188
+ type: 'asset/resource'
189
+ },
190
+ {
191
+ exclude: new RegExp(`\.g\.css$|\.min\.css$|node_modules\/(?!.*(${scripts_1.config.postcssWhitelist})).*\.css$`, 'u'),
192
+ test: /\.css$/u,
193
+ use: (0, styleLoaders_1.default)({
194
+ minimize: scripts_1.config.minimize && scripts_1.production,
195
+ modules: scripts_1.config.cssModules,
196
+ postcss: Boolean(scripts_1.config.postcss &&
197
+ scripts_1.config.webpackPostCSS),
198
+ sourceMap: scripts_1.config.sourceMaps
199
+ })
200
+ },
201
+ {
202
+ exclude: new RegExp(`\.min\.css$|node_modules\/(?!.*(${scripts_1.config.postcssWhitelist})).*\.css$`, 'u'),
203
+ test: /\.g\.css$/u,
204
+ use: (0, styleLoaders_1.default)({
205
+ minimize: scripts_1.config.minimize && scripts_1.production,
206
+ postcss: Boolean(scripts_1.config.postcss &&
207
+ scripts_1.config.webpackPostCSS),
208
+ sourceMap: scripts_1.config.sourceMaps
209
+ })
210
+ },
211
+ {
212
+ test: new RegExp(`\.min\.css$|node_modules\/(?!.*(${scripts_1.config.postcssWhitelist})).*\.css$`, 'u'),
213
+ use: (0, styleLoaders_1.default)({
214
+ camelCase: false,
215
+ minimize: false
216
+ })
217
+ },
218
+ {
219
+ exclude: /(node_modules|lib|dist)[\\/]/u,
220
+ test: /\.js$/u,
221
+ use: (0, scriptLoaders_1.default)()
222
+ },
223
+ {
224
+ exclude: /(node_modules|lib|dist)[\\/]/u,
225
+ test: /\.mjs$/u,
226
+ use: (0, scriptLoaders_1.default)()
227
+ }
228
+ ], scripts_1.config.react &&
229
+ scripts_1.config.webpackReact ?
230
+ [
231
+ {
232
+ exclude: /(node_modules|lib|dist)[\\/]/u,
233
+ test: /\.jsx$/u,
234
+ use: (0, scriptLoaders_1.default)()
235
+ }
236
+ ] :
237
+ [], scripts_1.config.typescript &&
238
+ scripts_1.config.webpackTypeScript ?
239
+ [
240
+ {
241
+ exclude: /(node_modules|lib|dist)[\\/]/u,
242
+ test: /\.ts$/u,
243
+ use: (0, scriptLoaders_1.default)({
244
+ typescript: true
245
+ })
246
+ }
247
+ ] :
248
+ [], scripts_1.config.react &&
249
+ scripts_1.config.webpackReact &&
250
+ scripts_1.config.typescript &&
251
+ scripts_1.config.webpackTypeScript ?
252
+ [
253
+ {
254
+ exclude: /(node_modules|lib|dist)[\\/]/u,
255
+ test: /\.tsx$/u,
256
+ use: (0, scriptLoaders_1.default)({
257
+ typescript: true
258
+ })
259
+ }
260
+ ] :
261
+ [], scripts_1.config.graphql &&
262
+ scripts_1.config.webpackGraphQL ?
263
+ [
264
+ {
265
+ exclude: /node_modules/u,
266
+ test: /\.(graphql|gql)$/u,
267
+ use: [
268
+ {
269
+ loader: 'graphql-tag/loader'
270
+ }
271
+ ]
272
+ }
273
+ ] :
274
+ [])
275
+ },
276
+ optimization: {
277
+ minimize: scripts_1.config.minimize && scripts_1.production,
278
+ minimizer: [
279
+ new terser_webpack_plugin_1.default({
280
+ extractComments: false,
281
+ parallel: scripts_1.config.parallel,
282
+ terserOptions: {
283
+ compress: true,
284
+ ecma: undefined,
285
+ ie8: false,
286
+ keep_classnames: false,
287
+ keep_fnames: false,
288
+ mangle: true,
289
+ module: true,
290
+ nameCache: {},
291
+ output: {
292
+ comments: false
293
+ },
294
+ safari10: false,
295
+ sourceMap: scripts_1.config.sourceMaps,
296
+ toplevel: true
297
+ }
298
+ }),
299
+ '...',
300
+ new css_minimizer_webpack_plugin_1.default({
301
+ minimizerOptions: {
302
+ preset: [
303
+ 'default',
304
+ {
305
+ discardComments: {
306
+ removeAll: true
307
+ }
308
+ }
309
+ ]
310
+ },
311
+ parallel: scripts_1.config.parallel,
312
+ warningsFilter: () => {
313
+ return true;
314
+ }
315
+ })
316
+ ],
317
+ moduleIds: scripts_1.production ?
318
+ undefined :
319
+ 'named',
320
+ providedExports: false,
321
+ runtimeChunk: scripts_1.config.library ?
322
+ false :
323
+ {
324
+ name: (entrypoint) => {
325
+ return `runtime.${entrypoint.name}`;
326
+ }
327
+ },
328
+ splitChunks: scripts_1.config.library ?
329
+ {} :
330
+ {
331
+ chunks: 'all'
332
+ }
333
+ },
334
+ output: {
335
+ chunkFilename: scripts_1.config.library ?
336
+ node_path_1.default.join(generateName('js')) :
337
+ node_path_1.default.join('scripts', 'chunks', generateName('js')),
338
+ crossOriginLoading: 'anonymous',
339
+ devtoolModuleFilenameTemplate: (info) => {
340
+ return `file://${node_path_1.default.resolve(info.absoluteResourcePath).replace('\\', '/')}`;
341
+ },
342
+ filename: (chunkData) => {
343
+ return scripts_1.config.library ?
344
+ node_path_1.default.join(generateName('js', chunkData)) :
345
+ node_path_1.default.join('scripts', generateName('js', chunkData));
346
+ },
347
+ library: scripts_1.config.library ?
348
+ 'index' :
349
+ undefined,
350
+ libraryTarget: 'umd',
351
+ path: node_path_1.default.resolve(scripts_1.config.staticPath, scripts_1.config.library ?
352
+ '' :
353
+ 'bundle'),
354
+ publicPath: scripts_1.config.library ?
355
+ './' :
356
+ './bundle/',
357
+ umdNamedDefine: true
358
+ },
359
+ performance: {
360
+ hints: false
361
+ },
362
+ plugins: [
363
+ new clean_terminal_webpack_plugin_1.default({
364
+ skipFirstRun: true
365
+ }),
366
+ new duplicate_package_checker_webpack_plugin_1.default({
367
+ emitError: true,
368
+ strict: true,
369
+ verbose: true
370
+ }),
371
+ new circular_dependency_plugin_1.default({
372
+ exclude: /node_modules/u
373
+ }),
374
+ new case_sensitive_paths_webpack_plugin_1.default(),
375
+ new webpack_1.DefinePlugin({
376
+ __DEV__: !scripts_1.production,
377
+ 'process.env': Object.assign(Object.assign({ BASE_HREF: scripts_1.config.baseHrefHtml ?
378
+ JSON.stringify(scripts_1.config.baseHrefHtml) :
379
+ undefined, BUILD: {
380
+ DATE: JSON.stringify(new Date().toString())
381
+ }, NODE_ENV: JSON.stringify(scripts_1.production ?
382
+ 'production' :
383
+ 'development') }, scripts_1.config.library ?
384
+ undefined :
385
+ {
386
+ PACKAGE: {
387
+ DESCRIPTION: JSON.stringify(scripts_1.package.description),
388
+ NAME: JSON.stringify(scripts_1.package.name),
389
+ TITLE: JSON.stringify(scripts_1.package.title),
390
+ VERSION: JSON.stringify(scripts_1.package.version)
391
+ }
392
+ }), scripts_1.config.env)
393
+ })
394
+ ].concat(scripts_1.config.eslint &&
395
+ scripts_1.config.webpackESLint ?
396
+ [
397
+ new ESLintPlugin({
398
+ failOnError: scripts_1.production,
399
+ failOnWarning: scripts_1.production,
400
+ formatter: 'eslint-formatter-friendly',
401
+ overrideConfigFile: scripts_1.config.eslint
402
+ })
403
+ ] :
404
+ [], scripts_1.production ?
405
+ [
406
+ new webpack_1.optimize.ModuleConcatenationPlugin(),
407
+ new mini_css_extract_plugin_1.default({
408
+ chunkFilename: scripts_1.config.library ?
409
+ node_path_1.default.join(generateName('css')) :
410
+ node_path_1.default.join('styles', 'chunks', generateName('css')),
411
+ filename: scripts_1.config.library ?
412
+ node_path_1.default.join(generateName('css')) :
413
+ node_path_1.default.join('styles', generateName('css'))
414
+ }),
415
+ new webpack_bundle_analyzer_1.BundleAnalyzerPlugin({
416
+ analyzerMode: 'static',
417
+ generateStatsFile: true,
418
+ logLevel: 'silent',
419
+ openAnalyzer: false,
420
+ reportFilename: scripts_1.config.reports ?
421
+ node_path_1.default.resolve(scripts_1.config.reports, 'webpack', 'index.html') :
422
+ undefined,
423
+ statsFilename: scripts_1.config.reports ?
424
+ node_path_1.default.resolve(scripts_1.config.reports, 'webpack', 'index.json') :
425
+ undefined,
426
+ statsOptions: {
427
+ publicPath: !scripts_1.production
428
+ }
429
+ })
430
+ ] :
431
+ [
432
+ new clean_webpack_plugin_1.CleanWebpackPlugin(),
433
+ new webpack_1.HotModuleReplacementPlugin()
434
+ ], !scripts_1.production &&
435
+ scripts_1.config.react &&
436
+ scripts_1.config.webpackReact ?
437
+ [
438
+ new ReactRefreshWebpackPlugin()
439
+ ] :
440
+ [], scripts_1.production ?
441
+ [] :
442
+ [
443
+ new webpack_1.NoEmitOnErrorsPlugin()
444
+ ], scripts_1.config.typescript &&
445
+ scripts_1.config.webpackTypeScript &&
446
+ scripts_1.config.parallel ?
447
+ [
448
+ new ForkTsCheckerWebpackPlugin({
449
+ typescript: {
450
+ configFile: scripts_1.config.typescript,
451
+ memoryLimit: Math.floor(node_v8_1.default.getHeapStatistics().heap_size_limit / 1000000)
452
+ }
453
+ })
454
+ ] :
455
+ [], scripts_1.config.indexHtml && !scripts_1.config.library && !(scripts_1.config.reactNative && !scripts_1.config.reactNativeWeb) ?
456
+ [
457
+ new html_webpack_plugin_1.default({
458
+ alwaysWriteToDisk: true,
459
+ baseHref: baseHrefHtml !== null && baseHrefHtml !== void 0 ? baseHrefHtml : '/',
460
+ filename: node_path_1.default.join('..', 'index.html'),
461
+ inject: 'body',
462
+ minify: scripts_1.production ?
463
+ {
464
+ collapseWhitespace: false,
465
+ includeAutoGeneratedTags: true,
466
+ keepClosingSlash: true,
467
+ minifyCSS: true,
468
+ minifyJS: true,
469
+ minifyURLs: true,
470
+ removeComments: false,
471
+ removeEmptyAttributes: true,
472
+ removeRedundantAttributes: true,
473
+ removeStyleLinkTypeAttributes: true,
474
+ useShortDoctype: true
475
+ } :
476
+ {},
477
+ scriptLoading: 'defer',
478
+ template: scripts_1.config.indexHtml,
479
+ title: scripts_1.package.title,
480
+ version: scripts_1.package.version
481
+ })
482
+ ] :
483
+ [], scripts_1.config.library || (scripts_1.config.reactNative && !scripts_1.config.reactNativeWeb) ?
484
+ [] :
485
+ [
486
+ new preload_webpack_plugin_1.default(),
487
+ new html_webpack_harddisk_plugin_1.default()
488
+ ], scripts_1.production && !scripts_1.config.library && !(scripts_1.config.reactNative && !scripts_1.config.reactNativeWeb) ?
489
+ [
490
+ new webpack_subresource_integrity_1.SubresourceIntegrityPlugin({
491
+ enabled: scripts_1.production
492
+ }),
493
+ new webpack_favicons_1.default({
494
+ appDescription: scripts_1.package.description,
495
+ appName: scripts_1.package.title,
496
+ background: '#fff',
497
+ developerName: (_a = scripts_1.package.author) === null || _a === void 0 ? void 0 : _a.name,
498
+ developerURL: (_b = scripts_1.package.author) === null || _b === void 0 ? void 0 : _b.url,
499
+ display: 'standalone',
500
+ icons: {
501
+ android: true,
502
+ appleIcon: true,
503
+ appleStartup: true,
504
+ coast: true,
505
+ favicons: true,
506
+ firefox: true,
507
+ windows: true,
508
+ yandex: true
509
+ },
510
+ manifestRelativePaths: true,
511
+ orientation: 'portrait',
512
+ path: node_path_1.default.join('favicons', '/'),
513
+ src: scripts_1.config.favicon,
514
+ start_url: baseHrefHtml !== null && baseHrefHtml !== void 0 ? baseHrefHtml : '/',
515
+ theme_color: '#fff',
516
+ version: scripts_1.package.version
517
+ }),
518
+ new html_webpack_link_type_plugin_1.HtmlWebpackLinkTypePlugin()
519
+ ] :
520
+ [], scripts_1.config.compression && scripts_1.production && !scripts_1.config.library ?
521
+ [
522
+ new compression_webpack_plugin_1.default({
523
+ algorithm: 'gzip',
524
+ compressionOptions: {
525
+ level: 9
526
+ },
527
+ filename: '[path][name][ext].gz[query]',
528
+ minRatio: 1,
529
+ threshold: 0
530
+ })
531
+ ] :
532
+ [], scripts_1.config.webpackWorkbox && scripts_1.production && !scripts_1.config.library && !(scripts_1.config.reactNative && !scripts_1.config.reactNativeWeb) ?
533
+ [
534
+ new GenerateSW({
535
+ cacheId: scripts_1.config.shortName,
536
+ clientsClaim: false,
537
+ directoryIndex: 'index.html',
538
+ exclude: [
539
+ /runtime((\.\w+)+)?.js($|\?\w+$)/u
540
+ ],
541
+ include: [
542
+ /\.cs{2}($|\?\w+$)/u,
543
+ /\.html($|\?\w+$)/u,
544
+ /\.js($|\?\w+$)/u
545
+ ],
546
+ modifyURLPrefix: {
547
+ bundle: node_path_1.default.join('.')
548
+ },
549
+ navigateFallback: `${baseHrefHtml !== null && baseHrefHtml !== void 0 ? baseHrefHtml : '/'}index.html`,
550
+ navigateFallbackDenylist: [].concat([
551
+ /\/bundle\//u,
552
+ /^\/_/u,
553
+ /\/[^/]+\\.[^/]+$/u
554
+ ]),
555
+ runtimeCaching: [
556
+ {
557
+ handler: 'CacheFirst',
558
+ urlPattern: /bundle/u
559
+ }
560
+ ],
561
+ swDest: node_path_1.default.join('..', 'workbox.js')
562
+ })
563
+ ] :
564
+ []),
565
+ profile: true,
566
+ resolve: {
567
+ alias: Object.assign({}, scripts_1.config.react && scripts_1.config.reactNative && scripts_1.config.reactNativeWeb && scripts_1.config.webpackReactNative ?
568
+ {
569
+ 'react-native$': 'react-native-web',
570
+ 'react-native-vector-icons': 'react-native-vector-icons/dist'
571
+ } :
572
+ {}),
573
+ extensions: [
574
+ ...scripts_1.config.reactNative && scripts_1.config.reactNativeWeb && scripts_1.config.webpackReactNative ?
575
+ [
576
+ '.web.js',
577
+ '.web.mjs',
578
+ '.web.jsx',
579
+ '.web.ts',
580
+ '.web.tsx'
581
+ ] :
582
+ [],
583
+ '.js',
584
+ '.mjs',
585
+ '.jsx',
586
+ '.ts',
587
+ '.tsx'
588
+ ],
589
+ modules: [
590
+ node_path_1.default.join('node_modules'),
591
+ node_path_1.default.join(process.cwd())
592
+ ]
593
+ },
594
+ resolveLoader: {
595
+ alias: Object.assign({}, scripts_1.config.react && scripts_1.config.reactNative && scripts_1.config.reactNativeWeb && scripts_1.config.webpackReactNative ?
596
+ {
597
+ 'react-native$': 'react-native-web',
598
+ 'react-native-vector-icons': 'react-native-vector-icons/dist'
599
+ } :
600
+ {}),
601
+ modules: [
602
+ node_path_1.default.join('node_modules'),
603
+ node_path_1.default.join(process.cwd())
604
+ ]
605
+ },
606
+ stats: 'minimal',
607
+ target: scripts_1.config.library ?
608
+ [
609
+ 'node'
610
+ ] :
611
+ [
612
+ 'web',
613
+ 'es5'
614
+ ]
615
+ };
616
+ module.exports = configuration;
617
+ exports.default = configuration;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@digest/webpack",
3
3
  "title": "Webpack Digest",
4
4
  "license": "LGPL-3.0-or-later",
5
- "version": "4.14.5",
5
+ "version": "4.14.8-next.1",
6
6
  "description": "Digested Webpack Configurations",
7
7
  "author": {
8
8
  "name": "wallzero @wallzeroblog",
@@ -93,5 +93,5 @@
93
93
  "build",
94
94
  "hmr"
95
95
  ],
96
- "gitHead": "76cfdd43321f96076fe3bf46658bf15dfead0896"
96
+ "gitHead": "2f4145c4391be317be01156076e642eeae4d4453"
97
97
  }