@best-shot/preset-web 0.14.6 → 0.14.8

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.
@@ -18,7 +18,14 @@ const force = {
18
18
 
19
19
  export function splitChunks({ vendors = {} }) {
20
20
  return async (chain) => {
21
- const settings = mapValues(vendors, (value, key, index, length) => {
21
+ const obj = {
22
+ ...(vendors.shim ? { shim: vendors.shim } : undefined),
23
+ ...(vendors.react ? { react: vendors.react } : undefined),
24
+ ...(vendors.vue ? { vue: vendors.vue } : undefined),
25
+ ...vendors,
26
+ };
27
+
28
+ const settings = mapValues(obj, (value, key, index, length) => {
22
29
  const mod = Array.isArray(value) ? `(${value.join('|')})` : value;
23
30
  const regexp = slashToRegexp(`/node_modules/${mod}/`);
24
31
 
@@ -37,27 +44,25 @@ export function splitChunks({ vendors = {} }) {
37
44
  ...force,
38
45
  };
39
46
 
40
- chain.optimization.splitChunks
41
- .set('maxAsyncRequests', 5)
42
- .set('cacheGroups', {
43
- ...settings,
44
- vendor:
45
- chain.entryPoints.values().length > 1
46
- ? {
47
- name: 'common',
48
- minChunks: 2,
49
- ...initial,
50
- }
51
- : {
52
- name: 'vendor',
53
- test: slashToRegexp('/node_modules/'),
54
- ...initial,
55
- },
56
- async: {
57
- chunks: 'async',
58
- ...force,
59
- },
60
- });
47
+ chain.optimization.splitChunks.maxAsyncRequests(5).cacheGroups({
48
+ ...settings,
49
+ vendor:
50
+ chain.entryPoints.values().length > 1
51
+ ? {
52
+ name: 'common',
53
+ minChunks: 2,
54
+ ...initial,
55
+ }
56
+ : {
57
+ name: 'vendor',
58
+ test: slashToRegexp('/node_modules/'),
59
+ ...initial,
60
+ },
61
+ async: {
62
+ chunks: 'async',
63
+ ...force,
64
+ },
65
+ });
61
66
 
62
67
  const mode = chain.get('mode');
63
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@best-shot/preset-web",
3
- "version": "0.14.6",
3
+ "version": "0.14.8",
4
4
  "description": "A `best-shot` preset for web project",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -43,11 +43,11 @@
43
43
  "webpack-subresource-integrity": "5.2.0-rc.1"
44
44
  },
45
45
  "peerDependencies": {
46
- "webpack": "^5.90.3",
47
- "@best-shot/core": "^0.9.6"
46
+ "webpack": "^5.91.0",
47
+ "@best-shot/core": "^0.9.10"
48
48
  },
49
49
  "engines": {
50
- "node": "^18.12.0 || ^20.0.0"
50
+ "node": ">=20.0.0 || ^18.12.0"
51
51
  },
52
52
  "publishConfig": {
53
53
  "access": "public",