@taro-minify-pack/preset 0.1.4-alpha.3 → 0.1.4
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/README.md +66 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
| @taro-minify-pack/plugin-remote-assets | 将静态资源上传到远程 CDN,减少主包大小,加快资源加载速度 |
|
|
18
18
|
| @taro-minify-pack/plugin-cover-browserslist | 根据微信小程序基础库版本自动设置 browserslist,减少不必要的 polyfill |
|
|
19
19
|
| @taro-minify-pack/plugin-bundle-analyzer | 可视化分析包体积,帮助识别体积过大的模块和依赖 |
|
|
20
|
+
| @taro-minify-pack/plugin-bundle-stats | 统计包体积统计信息,帮助分析包体积趋势和变化 |
|
|
20
21
|
|
|
21
22
|
## 📦 安装
|
|
22
23
|
|
|
@@ -93,6 +94,8 @@ module.exports = {
|
|
|
93
94
|
},
|
|
94
95
|
// 包体积分析配置
|
|
95
96
|
bundleAnalyzer: true,
|
|
97
|
+
// 开启包体积统计配置
|
|
98
|
+
bundleStats: true,
|
|
96
99
|
// 开启异步加载主包代码,优化主包体积
|
|
97
100
|
asyncPack: true
|
|
98
101
|
}],
|
|
@@ -165,6 +168,54 @@ module.exports = {
|
|
|
165
168
|
analyzerPort: 8888,
|
|
166
169
|
// 是否自动打开报告
|
|
167
170
|
openAnalyzer: true
|
|
171
|
+
},
|
|
172
|
+
// 开启包体积统计配置
|
|
173
|
+
bundleStats: {
|
|
174
|
+
// 是否生成 JSON 报告
|
|
175
|
+
json: true,
|
|
176
|
+
// 是否生成 HTML 报告
|
|
177
|
+
html: true,
|
|
178
|
+
// 是否静默模式
|
|
179
|
+
silent: false,
|
|
180
|
+
// 是否生成对比报告
|
|
181
|
+
compare: true,
|
|
182
|
+
// 是否生成 baseline.json
|
|
183
|
+
baseline: true,
|
|
184
|
+
// 报告保存路径
|
|
185
|
+
reportPath: 'bundleStatsReport',
|
|
186
|
+
// baseline.json 保存路径
|
|
187
|
+
baselinePath: 'baseline.json',
|
|
188
|
+
// 上传配置
|
|
189
|
+
upload: aliOssUploadAdapter({
|
|
190
|
+
customDomain: 'https://your-custom-domain.com',
|
|
191
|
+
accessKeyId: 'your-access-key-id',
|
|
192
|
+
accessKeySecret: 'your-access-key-secret',
|
|
193
|
+
bucket: 'your-bucket-name',
|
|
194
|
+
bucketDir: 'bucketDir',
|
|
195
|
+
region: 'your-region',
|
|
196
|
+
}),
|
|
197
|
+
stats: {
|
|
198
|
+
// Output webpack assets information (default: true)
|
|
199
|
+
assets: true,
|
|
200
|
+
// Output webpack chunks information (default: true)
|
|
201
|
+
chunks: true,
|
|
202
|
+
// Output webpack modules information (default: true)
|
|
203
|
+
modules: true,
|
|
204
|
+
// Output webpack hash information (default: true)
|
|
205
|
+
hash: true,
|
|
206
|
+
// Output webpack builtAt information (default: true)
|
|
207
|
+
builtAt: true
|
|
208
|
+
},
|
|
209
|
+
reportConfig: {
|
|
210
|
+
// 报告告显示数量限制
|
|
211
|
+
displayLimit: 20,
|
|
212
|
+
// 聚焦指标运行配置
|
|
213
|
+
focusMetricRun: {
|
|
214
|
+
assets: [],
|
|
215
|
+
modules: [],
|
|
216
|
+
packages: []
|
|
217
|
+
}
|
|
218
|
+
}
|
|
168
219
|
}
|
|
169
220
|
}],
|
|
170
221
|
],
|
|
@@ -212,6 +263,21 @@ module.exports = {
|
|
|
212
263
|
| analyzerPort | `number` \| `'auto'` | `8888` | 服务器端口 |
|
|
213
264
|
| openAnalyzer | `boolean` | `true` | 是否自动打开报告 |
|
|
214
265
|
|
|
266
|
+
### bundleStats 配置
|
|
267
|
+
|
|
268
|
+
| 选项名 | 类型 | 默认值 | 描述 |
|
|
269
|
+
|--------------|----------------------------------------------------------------|-----------------------|--------------------|
|
|
270
|
+
| json | `boolean` | `true` | 是否生成 JSON 报告 |
|
|
271
|
+
| html | `boolean` | `true` | 是否生成 HTML 报告 |
|
|
272
|
+
| silent | `boolean` | `false` | 是否静默模式 |
|
|
273
|
+
| compare | `boolean` | `true` | 是否生成对比报告 |
|
|
274
|
+
| baseline | `boolean` | `true` | 是否生成 baseline.json |
|
|
275
|
+
| reportPath | `string` | `'bundleStatsReport'` | 报告保存路径 |
|
|
276
|
+
| baselinePath | `string` | `'baseline.json'` | baseline.json 保存路径 |
|
|
277
|
+
| upload | `Function` | - | 上传配置 |
|
|
278
|
+
| stats | `Partial<WebpackStatsOptions>` | - | 统计信息配置 |
|
|
279
|
+
| reportConfig | `Omit<SummarizeReportOpt, 'appConfig' \| 'bundleStatsReport'>` | - | 报告配置 |
|
|
280
|
+
|
|
215
281
|
## 🎯 使用场景
|
|
216
282
|
|
|
217
283
|
* 需要快速优化 Taro 项目性能的场景
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taro-minify-pack/preset",
|
|
3
|
-
"version": "0.1.4
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"author": "yu.pan",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@taro-minify-pack/
|
|
19
|
-
"@taro-minify-pack/plugin-
|
|
20
|
-
"@taro-minify-pack/
|
|
21
|
-
"@taro-minify-pack/plugin-
|
|
22
|
-
"@taro-minify-pack/plugin-
|
|
23
|
-
"@taro-minify-pack/plugin-remote-assets": "0.1.4
|
|
18
|
+
"@taro-minify-pack/helper": "0.1.4",
|
|
19
|
+
"@taro-minify-pack/plugin-bundle-analyzer": "0.1.4",
|
|
20
|
+
"@taro-minify-pack/plugin-bundle-stats": "0.1.4",
|
|
21
|
+
"@taro-minify-pack/plugin-async-pack": "0.1.4",
|
|
22
|
+
"@taro-minify-pack/plugin-cover-browserslist": "0.1.4",
|
|
23
|
+
"@taro-minify-pack/plugin-remote-assets": "0.1.4"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "^18.19.130",
|