v-vite
v0.0.0
Published
A Vite.js plugin for integrating the V programming language with modern frontend tooling.
Maintainers
Readme
V-Vite Plugin 🔥
V-Vite Plugin is a Vite.js plugin designed to enhance the development experience of projects built with the V programming language.
✨ Features
- 🔄 Seamless integration of V with Vite.
- ⚡ Hot Module Replacement (HMR) support.
- 🚀 Efficient build process optimized for V projects.
📦 Installation
Using npm:
npm install v-vite --save-devUsing pnpm:
pnpm add v-vite --save-devUsing yarn:
yarn add v-vite --devUsing Bun:
bun add v-vite --devUsing Deno:
deno add npm:v-vite⚙️ Usage
Add v-vite to your vite.config.js or vite.config.ts:
import { defineConfig } from 'vite';
import v from 'v-vite';
export default defineConfig({
plugins: [v('src/resources/main.js')],
});🔧 Configuration
The plugin requires you to specify the entry points of your application. These can be JavaScript or CSS files, as well as preprocessed language elements like TypeScript, JSX, TSX, Sass, etc. You can provide a string, an array of entries, or a configuration object as specified below:
interface PluginConfig {
/** The path or paths of the entry points to compile. */
input: InputOption;
/** V's public directory. @default 'public' */
publicDirectory?: string;
/** The public subdirectory where compiled assets should be written. @default 'build' */
buildDirectory?: string;
/** The path to the "hot" file. @default `${publicDirectory}/hot` */
hotFile?: string;
/** The path of the SSR entry point. */
ssr?: InputOption;
/** The directory where the SSR bundle should be written. @default 'ssr' */
ssrOutputDirectory?: string;
/** Configuration for full page refresh on file changes. @default false */
refresh?: boolean | string | string[] | RefreshConfig | RefreshConfig[];
/** Transform the code while serving. */
transformOnServe?: (code: string, url: DevServerUrl) => string;
}
interface RefreshConfig {
paths: string[];
config?: FullReloadConfig;
}Example usage:
v({
input: ['src/rsources/main.css', 'src/resources/main.js'],
publicDirectory: 'static',
buildDirectory: 'dist',
hotFile: 'static/hot',
ssr: 'src/ssr-entry.v',
ssrOutputDirectory: 'server',
refresh: ['src/resources/**', 'src/templates/**'],
});🤝 Contribution
We welcome contributions! If you find an issue or have an idea for improvement, feel free to submit a pull request or open an issue.
📜 License
This project is licensed under the MIT License. See the LICENSE file for details.
