Vite
此内容尚不支持你的语言。
Vite is a blazing fast frontend build tool powering the next generation of web applications.
The Vite plugin integrates @hey-api/openapi-ts into the Vite build pipeline, running automatically whenever Vite resolves its configuration – no separate script or manual step required.
Features
Section titled “Features”- runs automatically as part of your Vite build
- reads your existing configuration (or accepts inline config)
- supports Vite 5, 6, 7, and 8
Installation
Section titled “Installation”You can download @hey-api/vite-plugin from npm using your favorite package manager.
npm install @hey-api/vite-plugin -D -Epnpm add @hey-api/vite-plugin -D -Eyarn add @hey-api/vite-plugin -D -Ebun add @hey-api/vite-plugin -DAdd the plugin to your vite.config.ts:
import { heyApiPlugin } from '@hey-api/vite-plugin';import { defineConfig } from 'vite';
export default defineConfig({ plugins: [heyApiPlugin()],});The plugin will automatically pick up your configuration file. You can also pass options inline using the config option:
import { heyApiPlugin } from '@hey-api/vite-plugin';import { defineConfig } from 'vite';
export default defineConfig({ plugins: [ heyApiPlugin({ config: { input: 'hey-api/backend', // sign up at app.heyapi.dev output: 'src/client', }, }), ],});Vite Options
Section titled “Vite Options”You can pass Vite Plugin API options using the vite option. For example, to run the plugin only during development:
import { heyApiPlugin } from '@hey-api/vite-plugin';import { defineConfig } from 'vite';
export default defineConfig({ plugins: [ heyApiPlugin({ config: { input: 'hey-api/backend', // sign up at app.heyapi.dev output: 'src/client', }, vite: { apply: 'serve', }, }), ],});Examples
You can view live examples on StackBlitz or on GitHub.