@digest/webpack 3.3.3 → 3.4.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.
- package/dist/webpack.config.js +154 -49
- package/package.json +16 -15
package/dist/webpack.config.js
CHANGED
|
@@ -24,6 +24,7 @@ const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plug
|
|
|
24
24
|
const terser_webpack_plugin_1 = __importDefault(require("terser-webpack-plugin"));
|
|
25
25
|
const webpack_1 = require("webpack");
|
|
26
26
|
const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
|
|
27
|
+
const webpack_favicons_1 = __importDefault(require("webpack-favicons"));
|
|
27
28
|
const webpack_node_externals_1 = __importDefault(require("webpack-node-externals"));
|
|
28
29
|
const webpack_subresource_integrity_1 = require("webpack-subresource-integrity");
|
|
29
30
|
let GenerateSW;
|
|
@@ -52,23 +53,30 @@ const workers = os_1.default.cpus().length - 2 < 1 ?
|
|
|
52
53
|
os_1.default.cpus().length - 2;
|
|
53
54
|
const threadLoader = {
|
|
54
55
|
loader: 'thread-loader',
|
|
55
|
-
options: {
|
|
56
|
+
options: {
|
|
57
|
+
workers
|
|
58
|
+
}
|
|
56
59
|
};
|
|
57
60
|
const styleLoaders = (options = {}) => {
|
|
58
61
|
options.camelCase = options.camelCase === undefined ?
|
|
59
62
|
true :
|
|
60
63
|
options.camelCase;
|
|
61
64
|
return [].concat(scripts_1.default.production ?
|
|
62
|
-
[
|
|
65
|
+
[
|
|
66
|
+
{
|
|
63
67
|
loader: mini_css_extract_plugin_1.default.loader,
|
|
64
68
|
options: {
|
|
65
69
|
publicPath: '../'
|
|
66
70
|
}
|
|
67
|
-
}
|
|
71
|
+
}
|
|
72
|
+
] :
|
|
68
73
|
[
|
|
69
74
|
threadLoader,
|
|
70
|
-
{
|
|
71
|
-
|
|
75
|
+
{
|
|
76
|
+
loader: 'style-loader'
|
|
77
|
+
}
|
|
78
|
+
], [
|
|
79
|
+
{
|
|
72
80
|
loader: 'css-loader',
|
|
73
81
|
options: {
|
|
74
82
|
importLoaders: 1,
|
|
@@ -84,8 +92,10 @@ const styleLoaders = (options = {}) => {
|
|
|
84
92
|
undefined,
|
|
85
93
|
sourceMap: options.sourceMap
|
|
86
94
|
}
|
|
87
|
-
}
|
|
88
|
-
|
|
95
|
+
}
|
|
96
|
+
], options.postcss ?
|
|
97
|
+
[
|
|
98
|
+
{
|
|
89
99
|
loader: 'postcss-loader',
|
|
90
100
|
options: {
|
|
91
101
|
postcssOptions: {
|
|
@@ -94,21 +104,27 @@ const styleLoaders = (options = {}) => {
|
|
|
94
104
|
},
|
|
95
105
|
sourceMap: options.sourceMap
|
|
96
106
|
}
|
|
97
|
-
}
|
|
107
|
+
}
|
|
108
|
+
] :
|
|
98
109
|
[], options.scss ?
|
|
99
|
-
[
|
|
110
|
+
[
|
|
111
|
+
{
|
|
100
112
|
loader: 'sass-loader',
|
|
101
113
|
options: {
|
|
102
114
|
sourceMap: options.sourceMap
|
|
103
115
|
}
|
|
104
|
-
}
|
|
116
|
+
}
|
|
117
|
+
] :
|
|
105
118
|
[]);
|
|
106
119
|
};
|
|
107
120
|
const scriptLoaders = (options = {}) => {
|
|
108
121
|
return [].concat(scripts_1.default.parallel ?
|
|
109
|
-
[
|
|
122
|
+
[
|
|
123
|
+
threadLoader
|
|
124
|
+
] :
|
|
110
125
|
[], scripts_1.default.webpackBabel ?
|
|
111
|
-
[
|
|
126
|
+
[
|
|
127
|
+
{
|
|
112
128
|
loader: 'babel-loader',
|
|
113
129
|
options: {
|
|
114
130
|
cacheDirectory: path_1.default.join(scripts_1.default.cache, 'babel-loader'),
|
|
@@ -119,15 +135,24 @@ const scriptLoaders = (options = {}) => {
|
|
|
119
135
|
].filter(Boolean) :
|
|
120
136
|
[]
|
|
121
137
|
}
|
|
122
|
-
}
|
|
138
|
+
}
|
|
139
|
+
] :
|
|
123
140
|
[], options.typescript ?
|
|
124
141
|
[].concat(!scripts_1.default.production && scripts_1.default.webpackAngular ?
|
|
125
142
|
[
|
|
126
|
-
{
|
|
127
|
-
|
|
143
|
+
{
|
|
144
|
+
loader: 'angular2-template-loader'
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
loader: '@angularclass/hmr-loader'
|
|
148
|
+
}
|
|
128
149
|
] :
|
|
129
150
|
[]) :
|
|
130
|
-
[], [
|
|
151
|
+
[], [
|
|
152
|
+
{
|
|
153
|
+
loader: 'source-map-loader'
|
|
154
|
+
}
|
|
155
|
+
]);
|
|
131
156
|
};
|
|
132
157
|
const generateName = (extension, chunkName) => {
|
|
133
158
|
const hash = extension === 'css' ?
|
|
@@ -174,47 +199,75 @@ const configuration = {
|
|
|
174
199
|
require.resolve('@digest/webpack-workbox') :
|
|
175
200
|
[], !scripts_1.default.library && scripts_1.default.webpackAngular ?
|
|
176
201
|
angularPolyfills :
|
|
177
|
-
[], [
|
|
202
|
+
[], [
|
|
203
|
+
scripts_1.default.context
|
|
204
|
+
])
|
|
178
205
|
},
|
|
179
206
|
externals: scripts_1.default.library ?
|
|
180
|
-
[
|
|
207
|
+
[
|
|
208
|
+
(0, webpack_node_externals_1.default)()
|
|
209
|
+
] :
|
|
181
210
|
undefined,
|
|
182
211
|
externalsPresets: scripts_1.default.library ?
|
|
183
|
-
{
|
|
212
|
+
{
|
|
213
|
+
node: true
|
|
214
|
+
} :
|
|
184
215
|
undefined,
|
|
185
216
|
mode: scripts_1.default.production ?
|
|
186
217
|
'production' :
|
|
187
218
|
'development',
|
|
188
219
|
module: {
|
|
189
|
-
rules: [].concat([
|
|
190
|
-
|
|
220
|
+
rules: [].concat([
|
|
221
|
+
{
|
|
222
|
+
generator: {
|
|
223
|
+
filename: `templates/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
|
|
224
|
+
},
|
|
191
225
|
test: /\.html$/u,
|
|
192
226
|
type: 'asset/resource'
|
|
193
|
-
},
|
|
194
|
-
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
generator: {
|
|
230
|
+
filename: `icons/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
|
|
231
|
+
},
|
|
195
232
|
test: /\.ico$/u,
|
|
196
233
|
type: 'asset/resource'
|
|
197
|
-
},
|
|
198
|
-
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
generator: {
|
|
237
|
+
filename: `images/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
|
|
238
|
+
},
|
|
199
239
|
test: /\.(png|jpg)$/u,
|
|
200
240
|
type: 'asset/resource'
|
|
201
|
-
},
|
|
202
|
-
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
generator: {
|
|
244
|
+
filename: `gifs/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
|
|
245
|
+
},
|
|
203
246
|
test: /\.gif$/u,
|
|
204
247
|
type: 'asset/resource'
|
|
205
|
-
},
|
|
206
|
-
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
generator: {
|
|
251
|
+
filename: `svg/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
|
|
252
|
+
},
|
|
207
253
|
test: /\.(svg)(\?v=\d\.\d\.\d)?$/u,
|
|
208
254
|
type: 'asset/resource'
|
|
209
|
-
},
|
|
210
|
-
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
generator: {
|
|
258
|
+
filename: `fonts/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
|
|
259
|
+
},
|
|
211
260
|
test: /\.woff(2)?(\?v=\d\.\d\.\d)?$/u,
|
|
212
261
|
type: 'asset/resource'
|
|
213
|
-
},
|
|
214
|
-
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
generator: {
|
|
265
|
+
filename: `fonts/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
|
|
266
|
+
},
|
|
215
267
|
test: /\.(ttf|eot)(\?v=\d\.\d\.\d)?$/u,
|
|
216
268
|
type: 'asset/resource'
|
|
217
|
-
},
|
|
269
|
+
},
|
|
270
|
+
{
|
|
218
271
|
exclude: new RegExp(`\.g\.css$|\.min\.css$|node_modules\/(?!.*(${scripts_1.default.postcssWhitelist})).*\.css$`, 'u'),
|
|
219
272
|
test: /\.css$/u,
|
|
220
273
|
use: styleLoaders({
|
|
@@ -223,28 +276,33 @@ const configuration = {
|
|
|
223
276
|
postcss: Boolean(scripts_1.default.webpackPostCSS),
|
|
224
277
|
sourceMap: scripts_1.default.sourceMap
|
|
225
278
|
})
|
|
226
|
-
},
|
|
279
|
+
},
|
|
280
|
+
{
|
|
227
281
|
test: /\.g\.css$/u,
|
|
228
282
|
use: styleLoaders({
|
|
229
283
|
minimize: scripts_1.default.minimize && scripts_1.default.production,
|
|
230
284
|
postcss: Boolean(scripts_1.default.webpackPostCSS),
|
|
231
285
|
sourceMap: scripts_1.default.sourceMap
|
|
232
286
|
})
|
|
233
|
-
},
|
|
287
|
+
},
|
|
288
|
+
{
|
|
234
289
|
test: new RegExp(`\.min\.css$|node_modules\/(?!.*(${scripts_1.default.postcssWhitelist})).*\.css$`, 'u'),
|
|
235
290
|
use: styleLoaders({
|
|
236
291
|
camelCase: false,
|
|
237
292
|
minimize: false
|
|
238
293
|
})
|
|
239
|
-
},
|
|
294
|
+
},
|
|
295
|
+
{
|
|
240
296
|
exclude: scripts_1.default.ignore,
|
|
241
297
|
test: /\.js$/u,
|
|
242
298
|
use: scriptLoaders()
|
|
243
|
-
},
|
|
299
|
+
},
|
|
300
|
+
{
|
|
244
301
|
exclude: scripts_1.default.ignore,
|
|
245
302
|
test: /\.mjs$/u,
|
|
246
303
|
use: scriptLoaders()
|
|
247
|
-
}
|
|
304
|
+
}
|
|
305
|
+
], scripts_1.default.webpackSCSS ?
|
|
248
306
|
[
|
|
249
307
|
{
|
|
250
308
|
exclude: new RegExp(`\.g\.(scss|sass)$|\.min\.(scss|sass)$|node_modules\/(?!.*(${scripts_1.default.postcssWhitelist})).*\.(scss|sass)$`, 'u'),
|
|
@@ -255,7 +313,8 @@ const configuration = {
|
|
|
255
313
|
scss: scripts_1.default.webpackSCSS,
|
|
256
314
|
sourceMap: scripts_1.default.sourceMap
|
|
257
315
|
})
|
|
258
|
-
},
|
|
316
|
+
},
|
|
317
|
+
{
|
|
259
318
|
test: /\.g\.(scss|sass)$/u,
|
|
260
319
|
use: styleLoaders({
|
|
261
320
|
minimize: scripts_1.default.minimize && scripts_1.default.production,
|
|
@@ -301,7 +360,11 @@ const configuration = {
|
|
|
301
360
|
{
|
|
302
361
|
exclude: /node_modules/u,
|
|
303
362
|
test: /\.(graphql|gql)$/u,
|
|
304
|
-
use: [
|
|
363
|
+
use: [
|
|
364
|
+
{
|
|
365
|
+
loader: 'graphql-tag/loader'
|
|
366
|
+
}
|
|
367
|
+
]
|
|
305
368
|
}
|
|
306
369
|
] :
|
|
307
370
|
[])
|
|
@@ -506,6 +569,31 @@ const configuration = {
|
|
|
506
569
|
new webpack_subresource_integrity_1.SubresourceIntegrityPlugin({
|
|
507
570
|
enabled: scripts_1.default.production
|
|
508
571
|
}),
|
|
572
|
+
new webpack_favicons_1.default({
|
|
573
|
+
appDescription: scripts_1.default.project.description,
|
|
574
|
+
appName: scripts_1.default.project.title,
|
|
575
|
+
background: '#fff',
|
|
576
|
+
developerName: scripts_1.default.project.author.name,
|
|
577
|
+
developerURL: scripts_1.default.project.author.url,
|
|
578
|
+
display: 'standalone',
|
|
579
|
+
icons: {
|
|
580
|
+
android: true,
|
|
581
|
+
appleIcon: true,
|
|
582
|
+
appleStartup: true,
|
|
583
|
+
coast: true,
|
|
584
|
+
favicons: true,
|
|
585
|
+
firefox: true,
|
|
586
|
+
windows: true,
|
|
587
|
+
yandex: true
|
|
588
|
+
},
|
|
589
|
+
manifestRelativePaths: true,
|
|
590
|
+
orientation: 'portrait',
|
|
591
|
+
path: path_1.default.join('favicons', '/'),
|
|
592
|
+
src: scripts_1.default.favicon,
|
|
593
|
+
start_url: scripts_1.default.baseHref,
|
|
594
|
+
theme_color: '#fff',
|
|
595
|
+
version: scripts_1.default.project.version
|
|
596
|
+
}),
|
|
509
597
|
new html_webpack_link_type_plugin_1.HtmlWebpackLinkTypePlugin()
|
|
510
598
|
] :
|
|
511
599
|
[], scripts_1.default.compression && scripts_1.default.production && !scripts_1.default.library ?
|
|
@@ -521,7 +609,8 @@ const configuration = {
|
|
|
521
609
|
})
|
|
522
610
|
] :
|
|
523
611
|
[], scripts_1.default.webpackWorkbox && scripts_1.default.production && !scripts_1.default.library ?
|
|
524
|
-
[
|
|
612
|
+
[
|
|
613
|
+
new GenerateSW({
|
|
525
614
|
cacheId: scripts_1.default.shortName,
|
|
526
615
|
clientsClaim: false,
|
|
527
616
|
directoryIndex: 'index.html',
|
|
@@ -542,18 +631,29 @@ const configuration = {
|
|
|
542
631
|
/^\/_/u,
|
|
543
632
|
/\/[^/]+\\.[^/]+$/u
|
|
544
633
|
], scripts_1.default.fallbackDenyList ?
|
|
545
|
-
[
|
|
634
|
+
[
|
|
635
|
+
scripts_1.default.fallbackDenyList
|
|
636
|
+
] :
|
|
546
637
|
[]),
|
|
547
|
-
runtimeCaching: [
|
|
638
|
+
runtimeCaching: [
|
|
639
|
+
{
|
|
548
640
|
handler: 'CacheFirst',
|
|
549
641
|
urlPattern: /bundle/u
|
|
550
|
-
}
|
|
642
|
+
}
|
|
643
|
+
],
|
|
551
644
|
swDest: path_1.default.join('..', 'workbox.js')
|
|
552
|
-
})
|
|
645
|
+
})
|
|
646
|
+
] :
|
|
553
647
|
[]),
|
|
554
648
|
profile: true,
|
|
555
649
|
resolve: {
|
|
556
|
-
extensions: [
|
|
650
|
+
extensions: [
|
|
651
|
+
'.js',
|
|
652
|
+
'.mjs',
|
|
653
|
+
'.jsx',
|
|
654
|
+
'.ts',
|
|
655
|
+
'.tsx'
|
|
656
|
+
],
|
|
557
657
|
modules: [
|
|
558
658
|
path_1.default.join('node_modules'),
|
|
559
659
|
path_1.default.join(process.cwd())
|
|
@@ -567,7 +667,12 @@ const configuration = {
|
|
|
567
667
|
},
|
|
568
668
|
stats: 'minimal',
|
|
569
669
|
target: scripts_1.default.library ?
|
|
570
|
-
[
|
|
571
|
-
|
|
670
|
+
[
|
|
671
|
+
'node'
|
|
672
|
+
] :
|
|
673
|
+
[
|
|
674
|
+
'web',
|
|
675
|
+
'es5'
|
|
676
|
+
]
|
|
572
677
|
};
|
|
573
678
|
module.exports = configuration;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@digest/webpack",
|
|
3
3
|
"title": "Webpack Digest",
|
|
4
4
|
"license": "GPL-3.0",
|
|
5
|
-
"version": "3.
|
|
5
|
+
"version": "3.4.1",
|
|
6
6
|
"description": "Digested Webpack Configurations",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "wallzero @wallzeroblog",
|
|
@@ -40,41 +40,42 @@
|
|
|
40
40
|
"clean": "rimraf node_modules dist package-lock.json npm-debug.log"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@digest/scripts": "^3.
|
|
43
|
+
"@digest/scripts": "^3.4.1",
|
|
44
44
|
"@vue/preload-webpack-plugin": "^2.0.0",
|
|
45
45
|
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
|
46
46
|
"circular-dependency-plugin": "^5.2.2",
|
|
47
47
|
"clean-terminal-webpack-plugin": "^3.0.0",
|
|
48
48
|
"clean-webpack-plugin": "^4.0.0",
|
|
49
|
-
"compression-webpack-plugin": "^9.0
|
|
50
|
-
"css-loader": "^6.
|
|
51
|
-
"css-minimizer-webpack-plugin": "^3.
|
|
49
|
+
"compression-webpack-plugin": "^9.2.0",
|
|
50
|
+
"css-loader": "^6.6.0",
|
|
51
|
+
"css-minimizer-webpack-plugin": "^3.4.1",
|
|
52
52
|
"duplicate-package-checker-webpack-plugin": "^3.0.0",
|
|
53
|
-
"html-loader": "^3.0
|
|
53
|
+
"html-loader": "^3.1.0",
|
|
54
54
|
"html-webpack-harddisk-plugin": "^2.0.0",
|
|
55
55
|
"html-webpack-link-type-plugin": "^1.1.1",
|
|
56
56
|
"html-webpack-plugin": "^5.5.0",
|
|
57
57
|
"identity-obj-proxy": "^3.0.0",
|
|
58
58
|
"ip": "^1.1.5",
|
|
59
|
-
"mini-css-extract-plugin": "^2.
|
|
59
|
+
"mini-css-extract-plugin": "^2.5.3",
|
|
60
60
|
"raw-loader": "^4.0.2",
|
|
61
|
-
"source-map-loader": "^3.0.
|
|
61
|
+
"source-map-loader": "^3.0.1",
|
|
62
62
|
"stats-webpack-plugin": "~0.7.0",
|
|
63
63
|
"style-loader": "^3.3.1",
|
|
64
|
-
"terser-webpack-plugin": "^5.
|
|
64
|
+
"terser-webpack-plugin": "^5.3.1",
|
|
65
65
|
"thread-loader": "^3.0.4",
|
|
66
66
|
"url-loader": "^4.1.1",
|
|
67
|
-
"webpack": "^5.
|
|
67
|
+
"webpack": "^5.69.0",
|
|
68
68
|
"webpack-bundle-analyzer": "^4.5.0",
|
|
69
|
-
"webpack-cli": "^4.9.
|
|
69
|
+
"webpack-cli": "^4.9.2",
|
|
70
|
+
"webpack-favicons": "^1.3.8",
|
|
70
71
|
"webpack-node-externals": "^3.0.0",
|
|
71
|
-
"webpack-subresource-integrity": "^5.
|
|
72
|
+
"webpack-subresource-integrity": "^5.1.0"
|
|
72
73
|
},
|
|
73
74
|
"devDependencies": {
|
|
74
75
|
"@types/clean-webpack-plugin": "^0.1.3",
|
|
75
76
|
"@types/ip": "^1.1.0",
|
|
76
|
-
"@types/mini-css-extract-plugin": "^2.
|
|
77
|
-
"@types/node": "^
|
|
77
|
+
"@types/mini-css-extract-plugin": "^2.5.1",
|
|
78
|
+
"@types/node": "^17.0.18",
|
|
78
79
|
"@types/terser-webpack-plugin": "^5.2.0",
|
|
79
80
|
"@types/webpack-bundle-analyzer": "^4.4.1",
|
|
80
81
|
"@types/webpack-env": "^1.16.3",
|
|
@@ -85,5 +86,5 @@
|
|
|
85
86
|
"build",
|
|
86
87
|
"hmr"
|
|
87
88
|
],
|
|
88
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "fe9b4c497d51cce743e952edc371c9003e55f876"
|
|
89
90
|
}
|