Skip to content

Latest commit

 

History

History
69 lines (51 loc) · 1.71 KB

File metadata and controls

69 lines (51 loc) · 1.71 KB

vite-plugin-vinext-zephyr

A Vite plugin for deploying Vinext applications with Zephyr Cloud.

Installation

pnpm add --save-dev vite-plugin-vinext-zephyr

Usage

Add the plugin after vinext() in your vite.config.ts:

import { defineConfig } from 'vite';
import vinext from 'vinext';
import { cloudflare } from '@cloudflare/vite-plugin';
import { withZephyr } from 'vite-plugin-vinext-zephyr';

export default defineConfig({
  plugins: [
    vinext(),
    cloudflare({
      viteEnvironment: {
        name: 'rsc',
        childEnvironments: ['ssr'],
      },
    }),
    withZephyr(),
  ],
});

Options

withZephyr({
  outputDir: 'dist',
  entrypoint: 'server/index.js',
  hooks: {},
});
  • outputDir - Build output directory. Defaults to dist.
  • entrypoint - Optional server entrypoint relative to output directory. Auto-detected by default.
  • hooks - Optional Zephyr deployment lifecycle hooks.

Entrypoint Auto-Detection

The plugin infers the entrypoint from Vite bundle hooks (writeBundle) without reading the filesystem directly. When entrypoint is not provided, it resolves:

  1. dist/server/index.js for App Router builds.
  2. dist/<worker-dir>/index.js when <worker-dir> contains wrangler.json or wrangler.jsonc (Pages Router builds).

License

Apache-2.0