@digest/webpack 3.3.1 → 3.3.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.
Files changed (2) hide show
  1. package/dist/webpack.config.js +133 -56
  2. package/package.json +13 -11
@@ -12,6 +12,7 @@ const preload_webpack_plugin_1 = __importDefault(require("@vue/preload-webpack-p
12
12
  const case_sensitive_paths_webpack_plugin_1 = __importDefault(require("case-sensitive-paths-webpack-plugin"));
13
13
  const circular_dependency_plugin_1 = __importDefault(require("circular-dependency-plugin"));
14
14
  const clean_terminal_webpack_plugin_1 = __importDefault(require("clean-terminal-webpack-plugin"));
15
+ const clean_webpack_plugin_1 = require("clean-webpack-plugin");
15
16
  const compression_webpack_plugin_1 = __importDefault(require("compression-webpack-plugin"));
16
17
  const css_minimizer_webpack_plugin_1 = __importDefault(require("css-minimizer-webpack-plugin"));
17
18
  const duplicate_package_checker_webpack_plugin_1 = __importDefault(require("duplicate-package-checker-webpack-plugin"));
@@ -51,23 +52,30 @@ const workers = os_1.default.cpus().length - 2 < 1 ?
51
52
  os_1.default.cpus().length - 2;
52
53
  const threadLoader = {
53
54
  loader: 'thread-loader',
54
- options: { workers }
55
+ options: {
56
+ workers
57
+ }
55
58
  };
56
59
  const styleLoaders = (options = {}) => {
57
60
  options.camelCase = options.camelCase === undefined ?
58
61
  true :
59
62
  options.camelCase;
60
63
  return [].concat(scripts_1.default.production ?
61
- [{
64
+ [
65
+ {
62
66
  loader: mini_css_extract_plugin_1.default.loader,
63
67
  options: {
64
68
  publicPath: '../'
65
69
  }
66
- }] :
70
+ }
71
+ ] :
67
72
  [
68
73
  threadLoader,
69
- { loader: 'style-loader' }
70
- ], [{
74
+ {
75
+ loader: 'style-loader'
76
+ }
77
+ ], [
78
+ {
71
79
  loader: 'css-loader',
72
80
  options: {
73
81
  importLoaders: 1,
@@ -83,8 +91,10 @@ const styleLoaders = (options = {}) => {
83
91
  undefined,
84
92
  sourceMap: options.sourceMap
85
93
  }
86
- }], options.postcss ?
87
- [{
94
+ }
95
+ ], options.postcss ?
96
+ [
97
+ {
88
98
  loader: 'postcss-loader',
89
99
  options: {
90
100
  postcssOptions: {
@@ -93,21 +103,27 @@ const styleLoaders = (options = {}) => {
93
103
  },
94
104
  sourceMap: options.sourceMap
95
105
  }
96
- }] :
106
+ }
107
+ ] :
97
108
  [], options.scss ?
98
- [{
109
+ [
110
+ {
99
111
  loader: 'sass-loader',
100
112
  options: {
101
113
  sourceMap: options.sourceMap
102
114
  }
103
- }] :
115
+ }
116
+ ] :
104
117
  []);
105
118
  };
106
119
  const scriptLoaders = (options = {}) => {
107
120
  return [].concat(scripts_1.default.parallel ?
108
- [threadLoader] :
121
+ [
122
+ threadLoader
123
+ ] :
109
124
  [], scripts_1.default.webpackBabel ?
110
- [{
125
+ [
126
+ {
111
127
  loader: 'babel-loader',
112
128
  options: {
113
129
  cacheDirectory: path_1.default.join(scripts_1.default.cache, 'babel-loader'),
@@ -118,15 +134,24 @@ const scriptLoaders = (options = {}) => {
118
134
  ].filter(Boolean) :
119
135
  []
120
136
  }
121
- }] :
137
+ }
138
+ ] :
122
139
  [], options.typescript ?
123
140
  [].concat(!scripts_1.default.production && scripts_1.default.webpackAngular ?
124
141
  [
125
- { loader: 'angular2-template-loader' },
126
- { loader: '@angularclass/hmr-loader' }
142
+ {
143
+ loader: 'angular2-template-loader'
144
+ },
145
+ {
146
+ loader: '@angularclass/hmr-loader'
147
+ }
127
148
  ] :
128
149
  []) :
129
- [], [{ loader: 'source-map-loader' }]);
150
+ [], [
151
+ {
152
+ loader: 'source-map-loader'
153
+ }
154
+ ]);
130
155
  };
131
156
  const generateName = (extension, chunkName) => {
132
157
  const hash = extension === 'css' ?
@@ -164,7 +189,7 @@ const configuration = {
164
189
  [] :
165
190
  [
166
191
  path_1.default.join('webpack', 'hot', 'dev-server'),
167
- path_1.default.join('webpack-hot-middleware', 'client')
192
+ path_1.default.join('webpack-hot-middleware', 'client') + `?path=${path_1.default.join(scripts_1.default.baseHref)}hot`
168
193
  ], !scripts_1.default.library && scripts_1.default.babelPolyfills ?
169
194
  babelPolyfills :
170
195
  [], scripts_1.default.library || !scripts_1.default.polyfills ?
@@ -173,47 +198,75 @@ const configuration = {
173
198
  require.resolve('@digest/webpack-workbox') :
174
199
  [], !scripts_1.default.library && scripts_1.default.webpackAngular ?
175
200
  angularPolyfills :
176
- [], [scripts_1.default.context])
201
+ [], [
202
+ scripts_1.default.context
203
+ ])
177
204
  },
178
205
  externals: scripts_1.default.library ?
179
- [(0, webpack_node_externals_1.default)()] :
206
+ [
207
+ (0, webpack_node_externals_1.default)()
208
+ ] :
180
209
  undefined,
181
210
  externalsPresets: scripts_1.default.library ?
182
- { node: true } :
211
+ {
212
+ node: true
213
+ } :
183
214
  undefined,
184
215
  mode: scripts_1.default.production ?
185
216
  'production' :
186
217
  'development',
187
218
  module: {
188
- rules: [].concat([{
189
- generator: { filename: `templates/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]` },
219
+ rules: [].concat([
220
+ {
221
+ generator: {
222
+ filename: `templates/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
223
+ },
190
224
  test: /\.html$/u,
191
225
  type: 'asset/resource'
192
- }, {
193
- generator: { filename: `icons/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]` },
226
+ },
227
+ {
228
+ generator: {
229
+ filename: `icons/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
230
+ },
194
231
  test: /\.ico$/u,
195
232
  type: 'asset/resource'
196
- }, {
197
- generator: { filename: `images/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]` },
233
+ },
234
+ {
235
+ generator: {
236
+ filename: `images/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
237
+ },
198
238
  test: /\.(png|jpg)$/u,
199
239
  type: 'asset/resource'
200
- }, {
201
- generator: { filename: `gifs/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]` },
240
+ },
241
+ {
242
+ generator: {
243
+ filename: `gifs/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
244
+ },
202
245
  test: /\.gif$/u,
203
246
  type: 'asset/resource'
204
- }, {
205
- generator: { filename: `svg/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]` },
247
+ },
248
+ {
249
+ generator: {
250
+ filename: `svg/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
251
+ },
206
252
  test: /\.(svg)(\?v=\d\.\d\.\d)?$/u,
207
253
  type: 'asset/resource'
208
- }, {
209
- generator: { filename: `fonts/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]` },
254
+ },
255
+ {
256
+ generator: {
257
+ filename: `fonts/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
258
+ },
210
259
  test: /\.woff(2)?(\?v=\d\.\d\.\d)?$/u,
211
260
  type: 'asset/resource'
212
- }, {
213
- generator: { filename: `fonts/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]` },
261
+ },
262
+ {
263
+ generator: {
264
+ filename: `fonts/[name][ext]?_=[hash:${scripts_1.default.HASH_LIMIT}]`
265
+ },
214
266
  test: /\.(ttf|eot)(\?v=\d\.\d\.\d)?$/u,
215
267
  type: 'asset/resource'
216
- }, {
268
+ },
269
+ {
217
270
  exclude: new RegExp(`\.g\.css$|\.min\.css$|node_modules\/(?!.*(${scripts_1.default.postcssWhitelist})).*\.css$`, 'u'),
218
271
  test: /\.css$/u,
219
272
  use: styleLoaders({
@@ -222,28 +275,33 @@ const configuration = {
222
275
  postcss: Boolean(scripts_1.default.webpackPostCSS),
223
276
  sourceMap: scripts_1.default.sourceMap
224
277
  })
225
- }, {
278
+ },
279
+ {
226
280
  test: /\.g\.css$/u,
227
281
  use: styleLoaders({
228
282
  minimize: scripts_1.default.minimize && scripts_1.default.production,
229
283
  postcss: Boolean(scripts_1.default.webpackPostCSS),
230
284
  sourceMap: scripts_1.default.sourceMap
231
285
  })
232
- }, {
286
+ },
287
+ {
233
288
  test: new RegExp(`\.min\.css$|node_modules\/(?!.*(${scripts_1.default.postcssWhitelist})).*\.css$`, 'u'),
234
289
  use: styleLoaders({
235
290
  camelCase: false,
236
291
  minimize: false
237
292
  })
238
- }, {
293
+ },
294
+ {
239
295
  exclude: scripts_1.default.ignore,
240
296
  test: /\.js$/u,
241
297
  use: scriptLoaders()
242
- }, {
298
+ },
299
+ {
243
300
  exclude: scripts_1.default.ignore,
244
301
  test: /\.mjs$/u,
245
302
  use: scriptLoaders()
246
- }], scripts_1.default.webpackSCSS ?
303
+ }
304
+ ], scripts_1.default.webpackSCSS ?
247
305
  [
248
306
  {
249
307
  exclude: new RegExp(`\.g\.(scss|sass)$|\.min\.(scss|sass)$|node_modules\/(?!.*(${scripts_1.default.postcssWhitelist})).*\.(scss|sass)$`, 'u'),
@@ -254,7 +312,8 @@ const configuration = {
254
312
  scss: scripts_1.default.webpackSCSS,
255
313
  sourceMap: scripts_1.default.sourceMap
256
314
  })
257
- }, {
315
+ },
316
+ {
258
317
  test: /\.g\.(scss|sass)$/u,
259
318
  use: styleLoaders({
260
319
  minimize: scripts_1.default.minimize && scripts_1.default.production,
@@ -300,7 +359,11 @@ const configuration = {
300
359
  {
301
360
  exclude: /node_modules/u,
302
361
  test: /\.(graphql|gql)$/u,
303
- use: [{ loader: 'graphql-tag/loader' }]
362
+ use: [
363
+ {
364
+ loader: 'graphql-tag/loader'
365
+ }
366
+ ]
304
367
  }
305
368
  ] :
306
369
  [])
@@ -382,12 +445,8 @@ const configuration = {
382
445
  libraryTarget: 'umd',
383
446
  path: scripts_1.default.staticPath,
384
447
  publicPath: scripts_1.default.library ?
385
- scripts_1.default.production ?
386
- './' :
387
- '/' :
388
- scripts_1.default.production ?
389
- './bundle/' :
390
- '/bundle/',
448
+ './' :
449
+ './bundle/',
391
450
  umdNamedDefine: true
392
451
  },
393
452
  performance: {
@@ -455,6 +514,7 @@ const configuration = {
455
514
  })
456
515
  ] :
457
516
  [
517
+ new clean_webpack_plugin_1.CleanWebpackPlugin(),
458
518
  new webpack_1.HotModuleReplacementPlugin()
459
519
  ], !scripts_1.default.production && scripts_1.default.webpackReact ?
460
520
  [
@@ -523,7 +583,8 @@ const configuration = {
523
583
  })
524
584
  ] :
525
585
  [], scripts_1.default.webpackWorkbox && scripts_1.default.production && !scripts_1.default.library ?
526
- [new GenerateSW({
586
+ [
587
+ new GenerateSW({
527
588
  cacheId: scripts_1.default.shortName,
528
589
  clientsClaim: false,
529
590
  directoryIndex: 'index.html',
@@ -544,18 +605,29 @@ const configuration = {
544
605
  /^\/_/u,
545
606
  /\/[^/]+\\.[^/]+$/u
546
607
  ], scripts_1.default.fallbackDenyList ?
547
- [scripts_1.default.fallbackDenyList] :
608
+ [
609
+ scripts_1.default.fallbackDenyList
610
+ ] :
548
611
  []),
549
- runtimeCaching: [{
612
+ runtimeCaching: [
613
+ {
550
614
  handler: 'CacheFirst',
551
615
  urlPattern: /bundle/u
552
- }],
616
+ }
617
+ ],
553
618
  swDest: path_1.default.join('..', 'workbox.js')
554
- })] :
619
+ })
620
+ ] :
555
621
  []),
556
622
  profile: true,
557
623
  resolve: {
558
- extensions: ['.js', '.mjs', '.jsx', '.ts', '.tsx'],
624
+ extensions: [
625
+ '.js',
626
+ '.mjs',
627
+ '.jsx',
628
+ '.ts',
629
+ '.tsx'
630
+ ],
559
631
  modules: [
560
632
  path_1.default.join('node_modules'),
561
633
  path_1.default.join(process.cwd())
@@ -569,7 +641,12 @@ const configuration = {
569
641
  },
570
642
  stats: 'minimal',
571
643
  target: scripts_1.default.library ?
572
- ['node'] :
573
- ['web', 'es5']
644
+ [
645
+ 'node'
646
+ ] :
647
+ [
648
+ 'web',
649
+ 'es5'
650
+ ]
574
651
  };
575
652
  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.3.1",
5
+ "version": "3.3.5",
6
6
  "description": "Digested Webpack Configurations",
7
7
  "author": {
8
8
  "name": "wallzero @wallzeroblog",
@@ -40,39 +40,41 @@
40
40
  "clean": "rimraf node_modules dist package-lock.json npm-debug.log"
41
41
  },
42
42
  "dependencies": {
43
- "@digest/scripts": "^3.3.1",
43
+ "@digest/scripts": "^3.3.5",
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
- "compression-webpack-plugin": "^9.0.1",
48
+ "clean-webpack-plugin": "^4.0.0",
49
+ "compression-webpack-plugin": "^9.2.0",
49
50
  "css-loader": "^6.5.1",
50
- "css-minimizer-webpack-plugin": "^3.1.4",
51
+ "css-minimizer-webpack-plugin": "^3.3.1",
51
52
  "duplicate-package-checker-webpack-plugin": "^3.0.0",
52
- "html-loader": "^3.0.1",
53
+ "html-loader": "^3.1.0",
53
54
  "html-webpack-harddisk-plugin": "^2.0.0",
54
55
  "html-webpack-link-type-plugin": "^1.1.1",
55
56
  "html-webpack-plugin": "^5.5.0",
56
57
  "identity-obj-proxy": "^3.0.0",
57
58
  "ip": "^1.1.5",
58
- "mini-css-extract-plugin": "^2.4.5",
59
+ "mini-css-extract-plugin": "^2.4.6",
59
60
  "raw-loader": "^4.0.2",
60
- "source-map-loader": "^3.0.0",
61
+ "source-map-loader": "^3.0.1",
61
62
  "stats-webpack-plugin": "~0.7.0",
62
63
  "style-loader": "^3.3.1",
63
- "terser-webpack-plugin": "^5.2.5",
64
+ "terser-webpack-plugin": "^5.3.0",
64
65
  "thread-loader": "^3.0.4",
65
66
  "url-loader": "^4.1.1",
66
- "webpack": "^5.64.1",
67
+ "webpack": "^5.65.0",
67
68
  "webpack-bundle-analyzer": "^4.5.0",
68
69
  "webpack-cli": "^4.9.1",
69
70
  "webpack-node-externals": "^3.0.0",
70
71
  "webpack-subresource-integrity": "^5.0.0-rc.1"
71
72
  },
72
73
  "devDependencies": {
74
+ "@types/clean-webpack-plugin": "^0.1.3",
73
75
  "@types/ip": "^1.1.0",
74
76
  "@types/mini-css-extract-plugin": "^2.4.0",
75
- "@types/node": "^16.11.7",
77
+ "@types/node": "^17.0.8",
76
78
  "@types/terser-webpack-plugin": "^5.2.0",
77
79
  "@types/webpack-bundle-analyzer": "^4.4.1",
78
80
  "@types/webpack-env": "^1.16.3",
@@ -83,5 +85,5 @@
83
85
  "build",
84
86
  "hmr"
85
87
  ],
86
- "gitHead": "98ab37eaea3ded8d0561b0cf592f5e862eabab8f"
88
+ "gitHead": "c92b63a632cc91df2fbfc342ae638ddee694f62c"
87
89
  }