@digest/webpack 3.5.0 → 3.6.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.
- package/dist/webpack.config.js +52 -40
- package/package.json +13 -13
package/dist/webpack.config.js
CHANGED
|
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a, _b;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const node_v8_1 = __importDefault(require("node:v8"));
|
|
10
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"));
|
|
@@ -16,7 +16,6 @@ const clean_webpack_plugin_1 = require("clean-webpack-plugin");
|
|
|
16
16
|
const compression_webpack_plugin_1 = __importDefault(require("compression-webpack-plugin"));
|
|
17
17
|
const css_minimizer_webpack_plugin_1 = __importDefault(require("css-minimizer-webpack-plugin"));
|
|
18
18
|
const duplicate_package_checker_webpack_plugin_1 = __importDefault(require("duplicate-package-checker-webpack-plugin"));
|
|
19
|
-
const eslint_webpack_plugin_1 = __importDefault(require("eslint-webpack-plugin"));
|
|
20
19
|
const html_webpack_harddisk_plugin_1 = __importDefault(require("html-webpack-harddisk-plugin"));
|
|
21
20
|
const html_webpack_link_type_plugin_1 = require("html-webpack-link-type-plugin");
|
|
22
21
|
const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
|
|
@@ -39,6 +38,11 @@ if (scripts_1.config.babel &&
|
|
|
39
38
|
scripts_1.config.babelPolyfills) {
|
|
40
39
|
babelPolyfills = require.resolve(scripts_1.config.babelPolyfills);
|
|
41
40
|
}
|
|
41
|
+
let ESLintPlugin;
|
|
42
|
+
if (scripts_1.config.eslint &&
|
|
43
|
+
scripts_1.config.webpackESLint) {
|
|
44
|
+
ESLintPlugin = require('eslint-webpack-plugin');
|
|
45
|
+
}
|
|
42
46
|
let babelPreset = null;
|
|
43
47
|
if (scripts_1.config.babel &&
|
|
44
48
|
scripts_1.config.babelPreset) {
|
|
@@ -60,9 +64,9 @@ if (!scripts_1.production &&
|
|
|
60
64
|
scripts_1.config.webpackReact) {
|
|
61
65
|
ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
|
62
66
|
}
|
|
63
|
-
const workers =
|
|
67
|
+
const workers = node_os_1.default.cpus().length - 2 < 1 ?
|
|
64
68
|
1 :
|
|
65
|
-
|
|
69
|
+
node_os_1.default.cpus().length - 2;
|
|
66
70
|
const threadLoader = {
|
|
67
71
|
loader: 'thread-loader',
|
|
68
72
|
options: {
|
|
@@ -132,7 +136,7 @@ const scriptLoaders = (options = {}) => {
|
|
|
132
136
|
loader: 'babel-loader',
|
|
133
137
|
options: {
|
|
134
138
|
cacheDirectory: cache ?
|
|
135
|
-
|
|
139
|
+
node_path_1.default.join(cache, 'babel-loader') :
|
|
136
140
|
false,
|
|
137
141
|
configFile: scripts_1.config.babel
|
|
138
142
|
}
|
|
@@ -178,7 +182,7 @@ const generateName = (extension, chunkName) => {
|
|
|
178
182
|
const configuration = {
|
|
179
183
|
cache: cache ?
|
|
180
184
|
{
|
|
181
|
-
cacheDirectory:
|
|
185
|
+
cacheDirectory: node_path_1.default.join(cache, 'webpack'),
|
|
182
186
|
type: 'filesystem'
|
|
183
187
|
} :
|
|
184
188
|
false,
|
|
@@ -194,8 +198,8 @@ const configuration = {
|
|
|
194
198
|
main: [].concat(scripts_1.production || scripts_1.config.library ?
|
|
195
199
|
[] :
|
|
196
200
|
[
|
|
197
|
-
|
|
198
|
-
|
|
201
|
+
node_path_1.default.join('webpack', 'hot', 'dev-server'),
|
|
202
|
+
node_path_1.default.join('webpack-hot-middleware', 'client') + `?path=${node_path_1.default.join(scripts_1.config.baseHref)}hot`
|
|
199
203
|
], !scripts_1.config.library &&
|
|
200
204
|
scripts_1.config.babel &&
|
|
201
205
|
babelPreset ?
|
|
@@ -321,9 +325,7 @@ const configuration = {
|
|
|
321
325
|
{
|
|
322
326
|
exclude: /(node_modules|lib|dist)[\\/\\\\]/u,
|
|
323
327
|
test: /\.jsx$/u,
|
|
324
|
-
use: scriptLoaders(
|
|
325
|
-
react: true
|
|
326
|
-
})
|
|
328
|
+
use: scriptLoaders()
|
|
327
329
|
}
|
|
328
330
|
] :
|
|
329
331
|
[], scripts_1.config.typescript &&
|
|
@@ -346,7 +348,6 @@ const configuration = {
|
|
|
346
348
|
exclude: /(node_modules|lib|dist)[\\/\\\\]/u,
|
|
347
349
|
test: /\.tsx$/u,
|
|
348
350
|
use: scriptLoaders({
|
|
349
|
-
react: true,
|
|
350
351
|
typescript: true
|
|
351
352
|
})
|
|
352
353
|
}
|
|
@@ -426,22 +427,22 @@ const configuration = {
|
|
|
426
427
|
},
|
|
427
428
|
output: {
|
|
428
429
|
chunkFilename: scripts_1.config.library ?
|
|
429
|
-
|
|
430
|
-
|
|
430
|
+
node_path_1.default.join(generateName('js')) :
|
|
431
|
+
node_path_1.default.join('scripts', 'chunks', generateName('js')),
|
|
431
432
|
crossOriginLoading: 'anonymous',
|
|
432
433
|
devtoolModuleFilenameTemplate: (info) => {
|
|
433
|
-
return `file://${
|
|
434
|
+
return `file://${node_path_1.default.resolve(info.absoluteResourcePath).replace('\\', '/')}`;
|
|
434
435
|
},
|
|
435
436
|
filename: (chunkData) => {
|
|
436
437
|
return scripts_1.config.library ?
|
|
437
|
-
|
|
438
|
-
|
|
438
|
+
node_path_1.default.join(generateName('js', chunkData)) :
|
|
439
|
+
node_path_1.default.join('scripts', generateName('js', chunkData));
|
|
439
440
|
},
|
|
440
441
|
library: scripts_1.config.library ?
|
|
441
442
|
'index' :
|
|
442
443
|
undefined,
|
|
443
444
|
libraryTarget: 'umd',
|
|
444
|
-
path:
|
|
445
|
+
path: node_path_1.default.resolve(scripts_1.config.staticPath, scripts_1.config.library ?
|
|
445
446
|
'' :
|
|
446
447
|
'bundle'),
|
|
447
448
|
publicPath: scripts_1.config.library ?
|
|
@@ -466,6 +467,7 @@ const configuration = {
|
|
|
466
467
|
}),
|
|
467
468
|
new case_sensitive_paths_webpack_plugin_1.default(),
|
|
468
469
|
new webpack_1.DefinePlugin({
|
|
470
|
+
__DEV__: !scripts_1.production,
|
|
469
471
|
'process.env': Object.assign(Object.assign({ BUILD: {
|
|
470
472
|
DATE: JSON.stringify(new Date().toString())
|
|
471
473
|
}, NODE_ENV: JSON.stringify(scripts_1.production ?
|
|
@@ -484,7 +486,7 @@ const configuration = {
|
|
|
484
486
|
].concat(scripts_1.config.eslint &&
|
|
485
487
|
scripts_1.config.webpackESLint ?
|
|
486
488
|
[
|
|
487
|
-
new
|
|
489
|
+
new ESLintPlugin({
|
|
488
490
|
failOnError: scripts_1.production,
|
|
489
491
|
failOnWarning: scripts_1.production,
|
|
490
492
|
formatter: 'eslint-formatter-friendly',
|
|
@@ -496,11 +498,11 @@ const configuration = {
|
|
|
496
498
|
new webpack_1.optimize.ModuleConcatenationPlugin(),
|
|
497
499
|
new mini_css_extract_plugin_1.default({
|
|
498
500
|
chunkFilename: scripts_1.config.library ?
|
|
499
|
-
|
|
500
|
-
|
|
501
|
+
node_path_1.default.join(generateName('css')) :
|
|
502
|
+
node_path_1.default.join('styles', 'chunks', generateName('css')),
|
|
501
503
|
filename: scripts_1.config.library ?
|
|
502
|
-
|
|
503
|
-
|
|
504
|
+
node_path_1.default.join(generateName('css')) :
|
|
505
|
+
node_path_1.default.join('styles', generateName('css'))
|
|
504
506
|
}),
|
|
505
507
|
new webpack_bundle_analyzer_1.BundleAnalyzerPlugin({
|
|
506
508
|
analyzerMode: 'static',
|
|
@@ -508,10 +510,10 @@ const configuration = {
|
|
|
508
510
|
logLevel: 'silent',
|
|
509
511
|
openAnalyzer: false,
|
|
510
512
|
reportFilename: scripts_1.config.reports ?
|
|
511
|
-
|
|
513
|
+
node_path_1.default.resolve(scripts_1.config.reports, 'webpack', 'index.html') :
|
|
512
514
|
undefined,
|
|
513
515
|
statsFilename: scripts_1.config.reports ?
|
|
514
|
-
|
|
516
|
+
node_path_1.default.resolve(scripts_1.config.reports, 'webpack', 'index.json') :
|
|
515
517
|
undefined,
|
|
516
518
|
statsOptions: {
|
|
517
519
|
publicPath: !scripts_1.production
|
|
@@ -538,18 +540,18 @@ const configuration = {
|
|
|
538
540
|
new ForkTsCheckerWebpackPlugin({
|
|
539
541
|
typescript: {
|
|
540
542
|
configFile: scripts_1.config.typescript,
|
|
541
|
-
memoryLimit: Math.floor(
|
|
543
|
+
memoryLimit: Math.floor(node_v8_1.default.getHeapStatistics().heap_size_limit / 1000000)
|
|
542
544
|
}
|
|
543
545
|
})
|
|
544
546
|
] :
|
|
545
|
-
[], scripts_1.config.indexHtml && !scripts_1.config.library ?
|
|
547
|
+
[], scripts_1.config.indexHtml && !scripts_1.config.library && !(scripts_1.config.reactNative && !scripts_1.config.reactNativeWeb) ?
|
|
546
548
|
[
|
|
547
549
|
new html_webpack_plugin_1.default({
|
|
548
550
|
alwaysWriteToDisk: true,
|
|
549
551
|
baseHref: scripts_1.config.baseHref ?
|
|
550
552
|
scripts_1.config.baseHref.replace(/\/?$/u, '/') :
|
|
551
553
|
'/',
|
|
552
|
-
filename:
|
|
554
|
+
filename: node_path_1.default.join('..', 'index.html'),
|
|
553
555
|
inject: 'body',
|
|
554
556
|
minify: scripts_1.production ?
|
|
555
557
|
{
|
|
@@ -572,12 +574,12 @@ const configuration = {
|
|
|
572
574
|
version: scripts_1.package.version
|
|
573
575
|
})
|
|
574
576
|
] :
|
|
575
|
-
[], scripts_1.config.library ?
|
|
577
|
+
[], scripts_1.config.library || (scripts_1.config.reactNative && !scripts_1.config.reactNativeWeb) ?
|
|
576
578
|
[] :
|
|
577
579
|
[
|
|
578
580
|
new preload_webpack_plugin_1.default(),
|
|
579
581
|
new html_webpack_harddisk_plugin_1.default()
|
|
580
|
-
], scripts_1.production && !scripts_1.config.library ?
|
|
582
|
+
], scripts_1.production && !scripts_1.config.library && !(scripts_1.config.reactNative && !scripts_1.config.reactNativeWeb) ?
|
|
581
583
|
[
|
|
582
584
|
new webpack_subresource_integrity_1.SubresourceIntegrityPlugin({
|
|
583
585
|
enabled: scripts_1.production
|
|
@@ -601,7 +603,7 @@ const configuration = {
|
|
|
601
603
|
},
|
|
602
604
|
manifestRelativePaths: true,
|
|
603
605
|
orientation: 'portrait',
|
|
604
|
-
path:
|
|
606
|
+
path: node_path_1.default.join('favicons', '/'),
|
|
605
607
|
src: scripts_1.config.favicon,
|
|
606
608
|
start_url: scripts_1.config.baseHref,
|
|
607
609
|
theme_color: '#fff',
|
|
@@ -621,7 +623,7 @@ const configuration = {
|
|
|
621
623
|
threshold: 0
|
|
622
624
|
})
|
|
623
625
|
] :
|
|
624
|
-
[], scripts_1.config.webpackWorkbox && scripts_1.production && !scripts_1.config.library ?
|
|
626
|
+
[], scripts_1.config.webpackWorkbox && scripts_1.production && !scripts_1.config.library && !(scripts_1.config.reactNative && !scripts_1.config.reactNativeWeb) ?
|
|
625
627
|
[
|
|
626
628
|
new GenerateSW({
|
|
627
629
|
cacheId: scripts_1.config.shortName,
|
|
@@ -636,7 +638,7 @@ const configuration = {
|
|
|
636
638
|
/\.js($|\?\w+$)/u
|
|
637
639
|
],
|
|
638
640
|
modifyURLPrefix: {
|
|
639
|
-
bundle:
|
|
641
|
+
bundle: node_path_1.default.join('.')
|
|
640
642
|
},
|
|
641
643
|
navigateFallback: `${scripts_1.config.baseHref}index.html`,
|
|
642
644
|
navigateFallbackDenylist: [].concat([
|
|
@@ -650,12 +652,17 @@ const configuration = {
|
|
|
650
652
|
urlPattern: /bundle/u
|
|
651
653
|
}
|
|
652
654
|
],
|
|
653
|
-
swDest:
|
|
655
|
+
swDest: node_path_1.default.join('..', 'workbox.js')
|
|
654
656
|
})
|
|
655
657
|
] :
|
|
656
658
|
[]),
|
|
657
659
|
profile: true,
|
|
658
660
|
resolve: {
|
|
661
|
+
alias: Object.assign({}, scripts_1.config.react && scripts_1.config.reactNative && scripts_1.config.reactNativeWeb && scripts_1.config.webpackReactNative ?
|
|
662
|
+
{
|
|
663
|
+
'react-native$': 'react-native-web'
|
|
664
|
+
} :
|
|
665
|
+
{}),
|
|
659
666
|
extensions: [
|
|
660
667
|
'.js',
|
|
661
668
|
'.mjs',
|
|
@@ -664,14 +671,19 @@ const configuration = {
|
|
|
664
671
|
'.tsx'
|
|
665
672
|
],
|
|
666
673
|
modules: [
|
|
667
|
-
|
|
668
|
-
|
|
674
|
+
node_path_1.default.join('node_modules'),
|
|
675
|
+
node_path_1.default.join(process.cwd())
|
|
669
676
|
]
|
|
670
677
|
},
|
|
671
678
|
resolveLoader: {
|
|
679
|
+
alias: Object.assign({}, scripts_1.config.react && scripts_1.config.reactNative && scripts_1.config.reactNativeWeb && scripts_1.config.webpackReactNative ?
|
|
680
|
+
{
|
|
681
|
+
'react-native$': 'react-native-web'
|
|
682
|
+
} :
|
|
683
|
+
{}),
|
|
672
684
|
modules: [
|
|
673
|
-
|
|
674
|
-
|
|
685
|
+
node_path_1.default.join('node_modules'),
|
|
686
|
+
node_path_1.default.join(process.cwd())
|
|
675
687
|
]
|
|
676
688
|
},
|
|
677
689
|
stats: 'minimal',
|
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": "3.
|
|
5
|
+
"version": "3.6.0",
|
|
6
6
|
"description": "Digested Webpack Configurations",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "wallzero @wallzeroblog",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"clean": "rimraf node_modules dist package-lock.json npm-debug.log"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@digest/scripts": "^3.
|
|
45
|
-
"@swc/core": "1.2.
|
|
44
|
+
"@digest/scripts": "^3.6.0",
|
|
45
|
+
"@swc/core": "^1.2.249",
|
|
46
46
|
"@vue/preload-webpack-plugin": "^2.0.0",
|
|
47
47
|
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
|
48
48
|
"circular-dependency-plugin": "^5.2.2",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"clean-webpack-plugin": "^4.0.0",
|
|
51
51
|
"compression-webpack-plugin": "^10.0.0",
|
|
52
52
|
"css-loader": "^6.7.1",
|
|
53
|
-
"css-minimizer-webpack-plugin": "^4.
|
|
53
|
+
"css-minimizer-webpack-plugin": "^4.1.0",
|
|
54
54
|
"duplicate-package-checker-webpack-plugin": "^3.0.0",
|
|
55
|
-
"html-loader": "^
|
|
55
|
+
"html-loader": "^4.1.0",
|
|
56
56
|
"html-webpack-harddisk-plugin": "^2.0.0",
|
|
57
57
|
"html-webpack-link-type-plugin": "^1.1.1",
|
|
58
58
|
"html-webpack-plugin": "^5.5.0",
|
|
@@ -63,30 +63,30 @@
|
|
|
63
63
|
"source-map-loader": "^4.0.0",
|
|
64
64
|
"stats-webpack-plugin": "~0.7.0",
|
|
65
65
|
"style-loader": "^3.3.1",
|
|
66
|
-
"terser-webpack-plugin": "^5.3.
|
|
66
|
+
"terser-webpack-plugin": "^5.3.6",
|
|
67
67
|
"thread-loader": "^3.0.4",
|
|
68
68
|
"url-loader": "^4.1.1",
|
|
69
|
-
"webpack": "^5.
|
|
70
|
-
"webpack-bundle-analyzer": "^4.
|
|
69
|
+
"webpack": "^5.74.0",
|
|
70
|
+
"webpack-bundle-analyzer": "^4.6.1",
|
|
71
71
|
"webpack-cli": "^4.10.0",
|
|
72
72
|
"webpack-favicons": "^1.3.8",
|
|
73
73
|
"webpack-node-externals": "^3.0.0",
|
|
74
74
|
"webpack-subresource-integrity": "^5.1.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@digest/webpack-workbox": "^3.
|
|
77
|
+
"@digest/webpack-workbox": "^3.6.0",
|
|
78
78
|
"@types/clean-webpack-plugin": "^0.1.3",
|
|
79
79
|
"@types/ip": "^1.1.0",
|
|
80
80
|
"@types/mini-css-extract-plugin": "^2.5.1",
|
|
81
|
-
"@types/node": "^18.
|
|
81
|
+
"@types/node": "^18.7.16",
|
|
82
82
|
"@types/terser-webpack-plugin": "^5.2.0",
|
|
83
|
-
"@types/webpack-bundle-analyzer": "^4.4.
|
|
84
|
-
"@types/webpack-env": "^1.
|
|
83
|
+
"@types/webpack-bundle-analyzer": "^4.4.2",
|
|
84
|
+
"@types/webpack-env": "^1.18.0"
|
|
85
85
|
},
|
|
86
86
|
"keywords": [
|
|
87
87
|
"webpack",
|
|
88
88
|
"build",
|
|
89
89
|
"hmr"
|
|
90
90
|
],
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "6dbabfc3844f33f4b2864fd4273a2b630504830f"
|
|
92
92
|
}
|