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