Goal
ใช้งาน Rolldown สำหรับ bundle JavaScript/TypeScript ด้วยความเร็วสูง
Scope
ใช้สำหรับ:
- Bundle JavaScript/TypeScript ด้วยความเร็วสูง
- Migration จาก Rollup ไปยัง Rust-based bundler
- Code splitting และ tree-shaking
- Plugin system ที่ compatible กับ Rollup
Execute
Quick Start
ติดตั้งและเริ่มต้นใช้งาน:
bun add -D rolldown
สร้าง config file:
import { defineConfig } from 'rolldown'
export default defineConfig({
input: 'src/index.ts',
output: {
dir: 'dist',
format: 'esm',
},
})
Build project:
bunx rolldown
Learning Path
- Getting Started: อ่าน learn/guide/getting-started.md
- Key Concepts: เรียนรู้ learn/key-concepts/three-stage-pipeline.md
- Best Practices: ดู learn/principles/best-practices.md
- Workflows: ใช้ workflows/setup-rolldown.md
Rules
- ใช้
bun add -D rolldownสำหรับติดตั้ง - ใช้
bunx rolldownสำหรับ build - ใช้
--watchสำหรับ watch mode - ใช้
--configสำหรับ config file - ใช้ TypeScript สำหรับ config file (rolldown.config.ts)
- ใช้
defineConfigสำหรับ type safety
Expected Outcome
- JavaScript/TypeScript ที่ bundled ด้วยความเร็วสูง
- Migration จาก Rollup ที่ smooth
- Code splitting ที่ efficient
- Tree-shaking ที่ effective
- Plugin system ที่ compatible
- Performance ที่ดีขึ้น 10-100x