vite について
viteは、Viteを扱う開発者向けのドキュメント参照スキルです。質問に応じてガイド、設定、プラグイン情報を案内し、開発、ビルド、SSR、デプロイ、APIをカバーします。
主な機能
- 01ガイド項目の参照マッピング
- 02Vite設定資料
- 03プラグイン選定案内
- 04CLIとAPIの情報
- 05SSRとデプロイのトピック
活用シーン
- 01Vite設定のガイドを探す
- 02Viteプラグインを選ぶ
- 03HMRやJavaScript APIを扱う
- 04SSRやデプロイ設定を調べる
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ partme-ai/ full-stack-skills --skill viteインストール後、Claude Code で/viteを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
api/cli.mdconfig.mdplugin-api.mdexamples/config/build-options.mdconfiguring-vite.mddep-optimization-options.mdpreview-options.mdserver-options.mdshared-options.mdssr-options.mdworker-options.mdexamples/guide/api-environment-frameworks.mdapi-environment-instances.mdapi-environment-plugins.mdapi-environment-runtimes.mdapi-environment.mdapi-hmr.mdapi-javascript.mdapi-plugin.mdassets.mdbackend-integration.mdbuild.mdcli.mddep-pre-bundling.mdenv-and-mode.mdfeatures.mdgetting-started.mdmigration.mdperformance.mdphilosophy.md詳細
このスキルを使用する場面
ユーザーが次のことを求めている場合は、いつでもこのスキルを使用します。
- 入門からパフォーマンスまで、Vite ガイドのトピックに沿って学ぶ
- 公式の設定リファレンスを使用して Vite を設定する
- 公式プラグインページを参考に、Vite プラグインを選択または理解する
- Vite CLI、HMR API、または JavaScript API を使用する
- Vite で SSR、バックエンド統合、またはデプロイのシナリオに対応する
このスキルの使用方法
- ユーザーのリクエストからトピックを特定します。
examples/guide/内の該当するガイドのサンプルファイルを開きます。- 設定が必要な場合は、
examples/config/内の該当するファイルを開きます。 - プラグインの選択が必要な場合は、
examples/plugins.mdを開きます。 - 公式ドキュメントに忠実に従い、参照先のページと一貫性のある出力にします。
- 検証:
npm run buildを実行して、設定変更がコンパイルできることを確認します。npm run previewを実行して、本番環境向けの出力をテストします。
ガイドの対応表(https://cn.vitejs.dev/guide/ と一対一に対応)
はじめに
examples/guide/getting-started.md→ https://cn.vitejs.dev/guide/examples/guide/philosophy.md→ https://cn.vitejs.dev/guide/philosophy.htmlexamples/guide/why-vite.md→ https://cn.vitejs.dev/guide/why.html
ガイド
examples/guide/features.md→ https://cn.vitejs.dev/guide/features.htmlexamples/guide/cli.md→ https://cn.vitejs.dev/guide/cli.htmlexamples/guide/using-plugins.md→ https://cn.vitejs.dev/guide/using-plugins.htmlexamples/guide/dep-pre-bundling.md→ https://cn.vitejs.dev/guide/dep-pre-bundling.htmlexamples/guide/assets.md→ https://cn.vitejs.dev/guide/assets.htmlexamples/guide/build.md→ https://cn.vitejs.dev/guide/build.htmlexamples/guide/static-deploy.md→ https://cn.vitejs.dev/guide/static-deploy.htmlexamples/guide/env-and-mode.md→ https://cn.vitejs.dev/guide/env-and-mode.htmlexamples/guide/ssr.md→ https://cn.vitejs.dev/guide/ssr.htmlexamples/guide/backend-integration.md→ https://cn.vitejs.dev/guide/backend-integration.htmlexamples/guide/troubleshooting.md→ https://cn.vitejs.dev/guide/troubleshooting.htmlexamples/guide/performance.md→ https://cn.vitejs.dev/guide/performance.htmlexamples/guide/migration.md→ https://cn.vitejs.dev/guide/migration.html
API
examples/guide/api-plugin.md→ https://cn.vitejs.dev/guide/api-plugin.htmlexamples/guide/api-hmr.md→ https://cn.vitejs.dev/guide/api-hmr.htmlexamples/guide/api-javascript.md→ https://cn.vitejs.dev/guide/api-javascript.html
環境 API
examples/guide/api-environment.md→ https://cn.vitejs.dev/guide/api-environment.htmlexamples/guide/api-environment-instances.md→ https://cn.vitejs.dev/guide/api-environment-instances.htmlexamples/guide/api-environment-plugins.md→ https://cn.vitejs.dev/guide/api-environment-plugins.htmlexamples/guide/api-environment-frameworks.md→ https://cn.vitejs.dev/guide/api-environment-frameworks.htmlexamples/guide/api-environment-runtimes.md→ https://cn.vitejs.dev/guide/api-environment-runtimes.html
設定の対応表(https://cn.vitejs.dev/config/ と一対一に対応)
examples/config/configuring-vite.md→ https://cn.vitejs.dev/config/examples/config/shared-options.md→ https://cn.vitejs.dev/config/shared-options.htmlexamples/config/server-options.md→ https://cn.vitejs.dev/config/server-options.htmlexamples/config/build-options.md→ https://cn.vitejs.dev/config/build-options.htmlexamples/config/preview-options.md→ https://cn.vitejs.dev/config/preview-options.htmlexamples/config/dep-optimization-options.md→ https://cn.vitejs.dev/config/dep-optimization-options.htmlexamples/config/ssr-options.md→ https://cn.vitejs.dev/config/ssr-options.htmlexamples/config/worker-options.md→ https://cn.vitejs.dev/config/worker-options.html
プラグインの対応表(https://cn.vitejs.dev/plugins/ と一対一に対応)
examples/plugins.md→ https://cn.vitejs.dev/plugins/
クイックスタート(インライン)
# Create a new Vite project
npm create vite@latest my-app -- --template react-ts
# Install and run
cd my-app && npm install
npm run dev # Dev server with HMR
npm run build # Production build
npm run preview # Preview production build
// vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
server: {
port: 3000,
proxy: {
'/api': 'http://localhost:8080',
},
},
build: {
sourcemap: true,
rollupOptions: {
output: {
manualChunks: { vendor: ['react', 'react-dom'] },
},
},
},
});
ベストプラクティス
- TypeScript の型ヒントと自動補完には
defineConfigを使用します - 開発中の API 呼び出しには、
server.proxyでプロキシを設定します - ベンダーコードの分割には、
build.rollupOptions.output.manualChunksを使用します - 開発環境ではソースマップを有効にし、本番環境ではビルドサイズを小さくするため無効にします
- 環境変数には
import.meta.envを使用します(VITE_をプレフィックスとして付けます)
リソース
- ガイド:https://cn.vitejs.dev/guide/
- 設定:https://cn.vitejs.dev/config/
- プラグイン:https://cn.vitejs.dev/plugins/
キーワード
Vite、ビルドツール、開発サーバー、HMR、設定、プラグイン、SSR、CLI、依存関係の事前バンドル、アセット
コメント
Markdown 対応