@digest/webpack 4.2.3 → 4.2.5

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