Przejdź do treści
Biblioteka skilli
Programowanie · Integracja z narzędziem

vite

/vite

Pomaga w pracy z Vite: serwer deweloperski ESM, buildy produkcyjne oparte na Rollup, pluginy, integracje frameworków, vite.config.ts, HMR, pre-bundling zależności i aplikacje SPA i SSR.

Repozytorium
Agent-Skills ↗
Licencja
MIT
Ostatnia zmiana repozytorium
01.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
2
Przestarzałość

Brak sygnałów. Repozytorium zmienione 01.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Pomaga w pracy z Vite: serwer deweloperski ESM, buildy produkcyjne oparte na Rollup, pluginy, integracje frameworków, vite.config.ts, HMR, pre-bundling zależności i aplikacje SPA i SSR.

Oryginalny opis (EN)

Expert Vite assistance covering modern frontend tooling, ESM development server, rollup-based production builds, Vite plugins, and framework integrations. Use when configuring vite.config.ts, setting up HMR, optimizing dependency pre-bundling, or building SPA/SSR applications.

Jak działa

  1. When to Use
  2. Quick Start
  3. Core Concepts
  4. Common Patterns
  5. Best Practices
  6. Troubleshooting
  7. References
Sekcje z nagłówków SKILL.md, w oryginale · 193 linii, 665 słów
Podgląd SKILL.md
---
name: vite
description: Expert Vite assistance covering modern frontend tooling, ESM development server, rollup-based production builds, Vite plugins, and framework integrations. Use when configuring vite.config.ts, setting up HMR, optimizing dependency pre-bundling, or building SPA/SSR applications.
---

# Vite

Vite is the modern frontend build tool providing an ultra-fast ESM development server, rich plugin ecosystem, and flexible Environment API for cross-runtime SSR.

## When to Use

- **High-Speed Frontend Application Development**: Instant dev server startup and lightning-fast HMR for React, Vue, Svelte, and Solid.
- **Optimized Production Bundling**: Generating tree-shaken, code-split production bundles using Rollup and esbuild.
- **Modern Full-Stack SSR & Library Development**: Building SSR setups, component libraries, and client-side SPAs.
- **Fast Unit & Component Testing with Vitest**: Executing unit tests using the identical Vite transform pipeline.

## Quick Start

### 1. Minimal vite.config.ts

```typescript
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";

export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
  server: {
    port: 3000,
    open: true,
  },
  build: {
    target: "esnext",
    sourcemap: true,
  },
});
```

### 2. Scaffold and Run

```bash
npm create vite@latest my-app -- --template react-ts
cd my-app && npm install && npm run dev
```

## Core Concepts

### Production Configuration (`vite.config.ts`)

Configuring plugins, build optimizations, path aliases, and local HTTPS:

```typescript
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "node:path";
import basicSsl from "@vitejs/plugin-basic-ssl";

export default defineConfig({
  plugins: [react(), basicSsl()],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
      "@components": path.resolve(__dirname, "./src/components"),
    },
  },
  server: {
    port: 3000,
    strictPort: true,
    open: true,
  },
  build: {
    target: "es2022",
    sourcemap: true,
    rollupOptions: {
      output: {
        manualChunks: {
          vendor: ["react", "react-dom", "react-router-dom"],
        },
      },
    },
    chunkSizeWarningLimit: 600,
  },
});
```

### Seamless Unit Testing with Vitest

Configuring Vitest directly within `vite.config.ts`:

```typescript
/// <reference types="vitest" />
import { defineConfig } from "vite";

export default defineConfig({
  test: {
    globals: true,
    environment: "jsdom",
    setupFiles: ["./src/test/setup.ts"],
    coverage: {
      provider: "v8",
      reporter: ["text", "json", "html"],
    },
  },
});
```

### Static Asset & Web Worker Handling

Importing assets and initializing Web Workers with native Vite syntax:

```typescript
// Import raw SVG string or URL
import logoUrl from "./assets/logo.svg";
import rawSvg from "./assets/logo.svg?raw";

// Spawn Web Worker with native ESM support
const worker = new Worker(new URL("./workers/compute.ts", import.meta.url), {
  type: "module",
});

worker.postMessage({ task: "PROCESS_IMAGE", data: [] });
worker.onmessage = (event) => console.log("Result:", event.data);
```

## Common Patterns

### Proxy API Requests in Development

**Problem**: Avoid CORS errors when frontend on `localhost:3000` talks to backend on `localhost:8080`.  
**Solution**: Configure dev server reverse proxy in `vite.config.ts`.

```typescript
export default defineConfig({
  server: {
    proxy: {
      "/api": {
        target: "http://localhost:8080",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      },
    },
  },
});
```

### Dynamic Code Splitting and Manual Chunks

**Problem**: Large vendor packages (e.g. `lodash`, `chart.js`) inflate initial bundle chunk.  
**Solution**: Configure `manualChunks` in Rollup output options.

```typescript
export default defineConfig({
  build: {
    rollupOptions: {
      output: {
        manualChunks: {
          vendor: ["react", "react-dom"],
          charts: ["chart.js"],
        },
      },
    },
  },
});
```

## Best Practices

**Do**:

- Use `@vitejs/plugin-react-swc` instead of Babel for maximum transpilation and HMR performance.
- Configure `manualChunks` in `rollupOptions` to split large vendor dependencies (React, UI libraries) into cached chunks.
- Pair Vite with **Vitest** to share the exact same configuration, plugins, and module resolution rules.
- Enforce `strictPort: true` in CI environments to prevent silent port fallback collisions.

**Don't**:

- Use Webpack-specific syntax (`require.context`, `module.hot`); use standard `import.meta.glob`.
- Leave source maps enabled in public production builds without uploading them to private error trackers (Sentry).
- Commit `dist/` or `.vite/` cache directories to Git.

## Troubleshooting

| Error                                                          | Cause                                                                          | Solution                                                                                  |
| -------------------------------------------------------------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------- |
| `[vite] Internal server error: Failed to resolve import "..."` | Missing path alias or file extension                                           | Add alias in `resolve.alias` inside `vite.config.ts` and verify file exists.              |
| HMR stops updating in browser without full reload              | Circular dependencies or component missing explicit React default/named export | Break circular dependency chain; ensure React components have capitalized function names. |
| `Outdated optimize dep` warning                                | Dependencies changed without clearing Vite cache                               | Run `npx vite --force` or delete `node_modules/.vite`.                                    |

## References

- [Vite Documentation](https://vitejs.dev/)

Wersje

RepozytoriumWynikLicencja
Ta strona · G1Joshi/Agent-Skills100MIT
TerminalSkills/skills100Apache-2.0
pleaseai/claude-code-plugins100MIT
sanity-io/plugins100MIT
antfu/skills100MIT
claude-dev-suite/claude-dev-suite100MIT
victorgarciaesgi/regle100MIT
pproenca/dot-skills100MIT
magnus919/agent-skills90MIT

Migawka bazy z 13.11.2026 · wersja paczki 8038e6eb17a2 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100vite-patterns
    Opisuje wzorce Vite: konfiguracja, pluginy, HMR, zmienne środowiskowe, proxy, SSR, tryb biblioteki, pre-bundling zależności i optymalizacja buildu.
  • 100vite-patterns
    Opisuje wzorce Vite: konfiguracja, pluginy, HMR, zmienne środowiskowe, proxy, SSR, tryb biblioteki, pre-bundling zależności i optymalizacja buildu.
  • 100vite-development
    Obsługuje narzędzie Vite 8.0.10: HMR, szybkie buildy, pluginy i zoptymalizowane zasoby produkcyjne, w projektach React i Vue.
  • 100vitejs-expert
    Dostarcza wiedzę o Vite: natywne serwery ESM, HMR, buildy produkcyjne oparte na Rollup oraz ekosystem pluginów dla React, Vue, Svelte i projektów bibliotek.
  • 100vite-patterns
    Wzorce konfiguracji Vite: wtyczki, HMR, zmienne środowiskowe, proxy, SSR, tryb biblioteki, wstępne łączenie zależności i optymalizacja buildu.
  • 100laravel-vite
    Konfiguruje bundlowanie Vite w Laravel: zasoby, HMR, SSR, integrację z frameworkami i optymalizację frontendowego potoku budowania.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.