Vite 构建产物体积优化

Analyze Vite build output with Rollup Visualizer and reduce bundle size via code splitting and tree shaking.

839|261|Updated Apr 18, 2019
One-click install
npx skills add https://github.com/TencentBlueKing/bk-bcs --skill vite-tencentblueking
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Vite 构建产物体积优化
Source: https://github.com/TencentBlueKing/bk-bcs/tree/main/bcs-services/bcs-project-manager/.cursor/skills/bundle-optimization
Command: npx skills add https://github.com/TencentBlueKing/bk-bcs --skill vite-tencentblueking

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes assets (resource) components.

What problem does it solve?

通过分析 Rollup Visualizer,识别产物体积热点,并结合拆包(Code Splitting)和 Tree Shaking 策略降低首屏加载时间。 这能帮助前端应用在使用 Vite 构建时提升首屏性能和用户体验。

Core Features & Use Cases

  • 使用 Rollup Visualizer 识别体积热点
  • 通过拆包和 Tree Shaking 优化依赖与代码分包
  • 适用于 Vite 构建的现代前端应用,快速提升首屏加载速度

Quick Start

运行本 Skill 以分析产物体积,应用拆包与 Tree Shaking 以降低首屏加载时间。

Frequently Asked Questions about Vite 构建产物体积优化

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce Vite bundle size for faster first-screen loading?

To reduce Vite bundle size, analyze the build output with Rollup Visualizer to identify volume hotspots, then apply code splitting and tree shaking to minimize first-screen loading time and improve content paint performance.

How does Rollup Visualizer identify bundle volume hotspots in Vite?

Rollup Visualizer identifies bundle volume hotspots by analyzing the Vite build output, generating a visual breakdown of module sizes to help you target dependencies and code segments for tree shaking and code splitting.

Can I use code splitting and tree shaking to optimize Vite build performance?

Yes, you can use code splitting and tree shaking to optimize Vite build performance by reorganizing dependencies and separating code bundles, which significantly reduces the initial payload required for first contentful paint.

Do I need a specific configuration file to analyze Vite build output?

Yes, analyzing Vite build output requires the presence of vite.config.optimization.ts as an asset. This configuration file may also reference optional scripts and references for deterministic optimization tasks.

What's the best way to optimize first contentful paint in modern front-end apps built with Vite?

The best way to optimize first contentful paint in Vite apps is by analyzing build artifacts for size hotspots and applying strategic code splitting alongside tree shaking to decrease the initial JavaScript bundle payload.

Why does my Vite build have a large first-screen bundle size?

A large first-screen bundle size in Vite builds typically results from unoptimized dependencies and unsplit code bundles, which can be diagnosed using Rollup Visualizer and resolved through targeted tree shaking and code splitting.