मुख्य सामग्री पर जाएँ
Skillpedia
वेबसाइट और UI (frontend)99k · #1288

vite

यह क्या करती है

यह स्किल AI को Vite सेट करने और उसे बेहतर बनाने में मार्गदर्शन देती है, जो वेब ऐप के लिए तेज़ बिल्ड और डेवलपमेंट टूल है। यह उन फ़्रंट-एंड डेवलपर के लिए है जिन्हें तेज़ रीलोड और कुशल बिल्ड चाहिए।

कब इस्तेमाल करें

  • ✓जब आप नया वेब ऐप शुरू कर रहे हैं और तेज़ डेवलपमेंट सेटअप चाहते हैं।
  • ✓जब आपका बिल्ड धीमा है या प्रोडक्शन बंडल बहुत बड़ा है।
  • ✓जब आपको Vite प्रोजेक्ट के लिए environment variables सेट करने हैं।

Skill का लिंक

https://github.com/debpalash/VoiceStudio/blob/main/.agents/skills/vite/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/debpalash/VoiceStudio/blob/main/.agents/skills/vite/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरे React प्रोजेक्ट के लिए Vite सेट कीजिए, src फ़ोल्डर के लिए एक alias के साथ, और environment फ़ाइल से API पता लेकर।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

AI एक Vite कॉन्फ़िगरेशन फ़ाइल सेट करता है जिसमें plugins, aliases और डेवलपमेंट सर्वर होते हैं। फिर दिखाता है कि डेवलपमेंट और प्रोडक्शन में कोड में environment variables कैसे पढ़े जाते हैं।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Vite Development

You are an expert in Vite, modern JavaScript/TypeScript build tooling, and frontend development.

Key Principles

  • Leverage native ES modules for fast development
  • Use Vite's opinionated defaults when possible
  • Configure only what needs customization
  • Understand the dev/build differences
  • Optimize for both development speed and production performance

Project Setup

Basic Configuration

// vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig({
  plugins: [react()],
  server: {
    port: 3000,
    open: true,
  },
  build: {
    outDir: 'dist',
    sourcemap: true,
  },
});

Path Aliases

import { defineConfig } from 'vite';

export default defineConfig({
  resolve: {
    alias: {
      '@': new URL('./src', import.meta.url).pathname,
      '@components': new URL('./src/components', import.meta.url).pathname,
      '@utils': new URL('./src/utils', import.meta.url).pathname,
    },
  },
});

Environment Variables

Usage

// .env
VITE_API_URL=https://api.example.com
VITE_APP_TITLE=My App

// In code
const apiUrl = import.meta.env.VITE_API_URL;
const isDev = import.meta.env.DEV;
const isProd = import.meta.env.PROD;
const mode = import.meta.env.MODE;

Type Definitions

// src/vite-env.d.ts
/// <reference types="vite/client" />

interface ImportMetaEnv {
  readonly VITE_API_URL: string;
  readonly VITE_APP_TITLE: string;
}

interface ImportMeta {
  readonly env: ImportMetaEnv;
}

Hot Module Replacement

Manual HMR

// For libraries without HMR support
if (import.meta.hot) {
  import.meta.hot.accept('./module.ts', (newModule) => {
    // Handle the updated module
    console.log('Module updated:', newModule);
  });

  import.meta.hot.dispose(() => {
    // Cleanup before module is replaced
  });
}

Asset Handling

Static Assets

// Import as URL
import imageUrl from './image.png';
// <img src={imageUrl} />

// Import as string (raw)
import shaderCode from './shader.glsl?raw';

// Import as worker
import Worker from './worker.ts?worker';
const worker = new Worker();

Public Directory

public/
├── favicon.ico      # Served at /favicon.ico
├── robots.txt       # Served at /robots.txt
└── images/          # Served at /images/

Framework Integrations

React

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig({
  plugins: [
    react({
      // Babel plugins
      babel: {
        plugins: ['@emotion/babel-plugin'],
      },
    }),
  ],
});

Vue

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';

export default defineConfig({
  plugins: [vue()],
});

Svelte

import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';

export default defineConfig({
  plugins: [svelte()],
});

Build Optimization

Code Splitting

// Dynamic imports create separate chunks
const AdminPanel = lazy(() => import('./AdminPanel'));

// Manual chunks
export default defineConfig({
  build: {
    rollupOptions: {
      output: {
        manualChunks: {
          vendor: ['react', 'react-dom'],
          utils: ['lodash', 'date-fns'],
        },
      },
    },
  },
});

Chunk Size Optimization

export default defineConfig({
  build: {
    chunkSizeWarningLimit: 500,
    rollupOptions: {
      output: {
        manualChunks(id) {
          if (id.includes('node_modules')) {
            return id.split('node_modules/')[1].split('/')[0];
          }
        },
      },
    },
  },
});

CSS Handling

CSS Modules

// styles.module.css is auto-detected
import styles from './styles.module.css';

// <div className={styles.container}>

PostCSS

// postcss.config.js
export default {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},
  },
};

Preprocessors

// Automatically handled with package installed
// npm install -D sass
import './styles.scss';

Proxy Configuration

export default defineConfig({
  server: {
    proxy: {
      '/api': {
        target: 'http://localhost:4000',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },
      '/socket.io': {
        target: 'ws://loca
अक्सर पूछे जाने वाले सवाल

क्या Vite सिर्फ़ React के साथ काम करता है?

नहीं। स्किल React सेटअप दिखाती है और दूसरे फ़्रेमवर्क इंटीग्रेशन का भी ज़िक्र करती है।

environment variables कहाँ रखे जाते हैं?

एक .env फ़ाइल में, और कोड में उन्हें import.meta.env से पढ़ा जाता है।

स्किल बिल्ड के बारे में क्या कहती है?

यह डेवलपमेंट और प्रोडक्शन मोड का फ़र्क समझाती है, ताकि आपको पता रहे कि अंतिम बिल्ड में क्या बदलता है।

जानकारी

लेखक का मूल विवरण

Expert guidance for Vite development with modern build tooling, HMR, framework integrations, and performance optimization

repo: debpalash/VoiceStudio

लोकप्रियता

GitHub स्टार
99k
रैंकिंग में स्थान
#1288
लाइसेंस
AGPL-3.0
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills