Bundle OptimizationSAFE
蓝鲸智云容器管理平台(BlueKing Container Service)
Overview
蓝鲸智云容器管理平台(BlueKing Container Service)
87a6fdb6f4b4OBSERVED · 2026-10-12Install
Commands as the repository documents them. They are shown, not run.
npm install rollup-plugin-visualizer -D
npm install vite-plugin-compression -D
What it tells the agent
The instruction file, verbatim from the audited commit — this is the text the model reads, and the surface the audit's instruction layer examines. Quoted here so you can judge it without cloning anything.
---
id: eng-bundle-opt
name: Vite 构建产物体积优化
category: engineering
description: 使用 Rollup Visualizer 分析产物,并通过拆包 (Code Splitting) 和 Tree Shaking 减少首屏体积。
tags: [vite, rollup, performance, optimization]
updated_at: 2026-01-09
---
# Vite 构建产物体积优化
当首屏加载慢 (FCP > 1.5s) 时,通常需要检查 JS Bundle 的体积。
## 1. 产物分析 (Visualizer)
首先"看见"哪些包最大。
```bash
npm install rollup-plugin-visualizer -D
```
## 2. 常用优化策略
### 路由懒加载 (Route Lazy Loading)
**这是收益最大的优化点**。
❌ `import UserList from './views/UserList.vue'`
✅ `component: () => import('./views/UserList.vue')`
### 依赖分包 (Manual Chunks)
将大型库(ECharts, bkui-vue)单独打包,避免 vendor hash 频繁变化。
### 按需引入 (Tree Shaking)
❌ `import _ from 'lodash'`
✅ `import debounce from 'lodash-es/debounce'`
### Gzip 压缩
```bash
npm install vite-plugin-compression -D
```
## 3. 完整配置模版
> 📦 获取完整 vite.config.ts 配置:`skill://bundle-optimization/assets/vite.config.optimization.ts`
---
## 📦 可用资源
- `skill://bundle-optimization/assets/vite.config.optimization.ts`
> 根据 SKILL.md 中的 IF-THEN 规则判断是否需要加载Trust audit
SAFEgrade B · trust 89/100 Nothing in the source contradicts what it says it does. Grade A is reserved for packages that have also passed the behavioural sandbox.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | WARN |
| L1 | Static analysis of the code | NA |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | PASS |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- none-observed
- Network
- none-observed
- Shell
- none-observed
- Dependencies
- pinned
- Secrets in source
- none-found
Findings (1)
.codebuddy
Gates applied: no_behavioural_pass.
87a6fdb6f4b4full audit observations/trust-audit/skill/tencentblueking__bundle-optimization.json · Report an issue / request a re-scanAudit history
Every audit this skill has had.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-12 | 87a6fdb6f4b4 | SAFE | B | 89 | first audit |
Questions
What does the Bundle Optimization skill do?
蓝鲸智云容器管理平台(BlueKing Container Service)
Is Bundle Optimization safe to install?
The audit found nothing in the source that contradicts what it says it does, and graded it B (89/100). Grade A is held back for packages that have also passed a sandboxed behavioural run, which is why a clean skill reads B.
What can Bundle Optimization access on my machine?
The audit observed no filesystem, network or shell use at all in its source.
How current is this page?
The grade is for one exact copy of the source (87a6fdb6f4b4), read on 2026-10-12. The repository is watched, and a new audit runs when it changes — this is the first audit.