/vite-plugin-wrangler-dev

[WIP] Vite with Wrangler

Primary LanguageTypeScript

vite-plugin-wrangler-dev

vite-plugin-wrangler-dev is a Vite Plugin designed for the development of Cloudflare Workers or Cloudflare Pages. It allows the "wrangler dev server" to run inside of Vite, makes the use of Workers Bindings possible for Vite-based web frameworks.

Demo

Screen.Recording.2023-07-24.at.16.34.59.mov

Status

WIP. It's not published yet.

Usage

import { defineConfig } from 'vite'
import vitePluginWranglerDev from '../src'

export default defineConfig({
  plugins: [
    vitePluginWranglerDev({
      entry: '/src/_worker.ts',
      client: '/src/client.ts',
      passThrough: ['/js/client.js']
    })
  ]
})

Options

type WranglerDevOptions = {
  entry?: string
  client?: string
  assetDirectory?: string
  passThrough?: string[]
  wranglerDevOptions?: UnstableDevOptions
}

Authors

Yusuke Wada https://github.com/yusukebe

License

MIT