@best-shot/preset-mini 0.10.8 → 0.10.10
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/index.mjs +34 -26
- package/package.json +3 -3
package/index.mjs
CHANGED
|
@@ -2,25 +2,32 @@ export function apply({
|
|
|
2
2
|
config: { mini: { type } = {}, output: { module: Module } = {} },
|
|
3
3
|
}) {
|
|
4
4
|
return async (chain) => {
|
|
5
|
-
chain.output
|
|
5
|
+
chain.output
|
|
6
|
+
.publicPath('/')
|
|
7
|
+
.iife(false)
|
|
8
|
+
.asyncChunks(false)
|
|
9
|
+
.filename('[name].js')
|
|
10
|
+
.globalObject('globalThis')
|
|
11
|
+
.strictModuleErrorHandling(true)
|
|
12
|
+
.environment({
|
|
13
|
+
document: false,
|
|
14
|
+
dynamicImport: false,
|
|
15
|
+
globalThis: true,
|
|
16
|
+
arrowFunction: true,
|
|
17
|
+
module: true,
|
|
18
|
+
});
|
|
6
19
|
|
|
7
20
|
if (Module) {
|
|
8
21
|
chain.output.merge({
|
|
9
22
|
module: true,
|
|
10
23
|
chunkFormat: 'module',
|
|
11
24
|
chunkLoading: 'import',
|
|
12
|
-
library: {
|
|
13
|
-
type: 'module',
|
|
14
|
-
},
|
|
15
25
|
});
|
|
16
26
|
} else {
|
|
17
27
|
chain.output.merge({
|
|
18
28
|
module: false,
|
|
19
29
|
chunkFormat: 'commonjs',
|
|
20
30
|
chunkLoading: 'require',
|
|
21
|
-
library: {
|
|
22
|
-
type: 'commonjs2',
|
|
23
|
-
},
|
|
24
31
|
});
|
|
25
32
|
}
|
|
26
33
|
|
|
@@ -61,7 +68,7 @@ export function apply({
|
|
|
61
68
|
modules: false,
|
|
62
69
|
}));
|
|
63
70
|
|
|
64
|
-
chain.experiments.
|
|
71
|
+
chain.experiments.layers(true);
|
|
65
72
|
|
|
66
73
|
const rule = chain.module.rule('babel');
|
|
67
74
|
|
|
@@ -77,21 +84,25 @@ export function apply({
|
|
|
77
84
|
|
|
78
85
|
const presets = ['vendor', 'common', 'shim', 'vue-mini', 'vue', 'react'];
|
|
79
86
|
|
|
80
|
-
chain.optimization.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
chain.optimization.avoidEntryIife(true);
|
|
88
|
+
|
|
89
|
+
if (chain.optimization.splitChunks.get('cacheGroups')) {
|
|
90
|
+
chain.optimization.splitChunks.cacheGroups(
|
|
91
|
+
Object.fromEntries(
|
|
92
|
+
Object.entries(chain.optimization.splitChunks.get('cacheGroups')).map(
|
|
93
|
+
([key, value]) => [
|
|
94
|
+
key,
|
|
95
|
+
{
|
|
96
|
+
...value,
|
|
97
|
+
name: presets.includes(value.name)
|
|
98
|
+
? ['share', value.name].join('/')
|
|
99
|
+
: value.name,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
),
|
|
92
103
|
),
|
|
93
|
-
)
|
|
94
|
-
|
|
104
|
+
);
|
|
105
|
+
}
|
|
95
106
|
};
|
|
96
107
|
}
|
|
97
108
|
|
|
@@ -108,7 +119,7 @@ export const schema = {
|
|
|
108
119
|
},
|
|
109
120
|
},
|
|
110
121
|
target: {
|
|
111
|
-
default: '
|
|
122
|
+
default: 'es2015',
|
|
112
123
|
},
|
|
113
124
|
context: {
|
|
114
125
|
default: 'src',
|
|
@@ -122,9 +133,6 @@ export const schema = {
|
|
|
122
133
|
keep: 'miniprogram_npm',
|
|
123
134
|
},
|
|
124
135
|
},
|
|
125
|
-
publicPath: {
|
|
126
|
-
default: '/',
|
|
127
|
-
},
|
|
128
136
|
cssFilename: {
|
|
129
137
|
default: '.wxss',
|
|
130
138
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@best-shot/preset-mini",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.10",
|
|
4
4
|
"description": "A `best-shot` preset for mini program project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"type": "module",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"yaml": "^2.7.1",
|
|
32
|
-
"@best-shot/sfc-split-plugin": "~0.13.
|
|
32
|
+
"@best-shot/sfc-split-plugin": "~0.13.15"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@best-shot/core": "~0.12.
|
|
35
|
+
"@best-shot/core": "~0.12.11",
|
|
36
36
|
"@best-shot/preset-babel": "~0.17.6",
|
|
37
37
|
"@best-shot/preset-style": "~0.15.5"
|
|
38
38
|
},
|