@cloudflare/vite-plugin
Version:
Cloudflare plugin for Vite
40 lines (36 loc) • 1.3 kB
TypeScript
import * as vite from 'vite';
type PersistState = boolean | {
path: string;
};
interface BaseWorkerConfig {
viteEnvironment?: {
name?: string;
};
}
interface EntryWorkerConfig extends BaseWorkerConfig {
configPath?: string;
}
interface AuxiliaryWorkerConfig extends BaseWorkerConfig {
configPath: string;
}
interface Experimental {
/** Experimental support for handling the _headers and _redirects files during Vite dev mode. */
headersAndRedirectsDevModeSupport?: boolean;
/** Experimental support for remote bindings (where bindings configured with `remote: true` access remote resources). */
remoteBindings?: boolean;
}
interface PluginConfig extends EntryWorkerConfig {
auxiliaryWorkers?: AuxiliaryWorkerConfig[];
persistState?: PersistState;
inspectorPort?: number | false;
experimental?: Experimental;
}
/**
* Vite plugin that enables a full-featured integration between Vite and the Cloudflare Workers runtime.
*
* See the [README](https://github.com/cloudflare/workers-sdk/tree/main/packages/vite-plugin-cloudflare#readme) for more details.
*
* @param pluginConfig An optional {@link PluginConfig} object.
*/
declare function cloudflare(pluginConfig?: PluginConfig): vite.Plugin[];
export { type PluginConfig, cloudflare };