Skip to content

sapphi-red/vite-envs

Repository files navigation

vite-envs

PoC for running Vite's SSR support on emulated environments (e.g. Edge Runtime).

Powered by Vite Runtime API.

Features

  • Throwing errors when accessing global variables that exist in Node but don't in workers (e.g. process, global)
  • Ability to use worker-only features that are not supported in Node (e.g. Cloudflare KV, URLPattern)
  • Performant HMR

How to try this?

$ pnpm i
$ pnpm -r build
$ cd examples/cloudflare-pages # or other directories in example
$ pnpm dev

Description for each directory

  • packages
    • types: contains types for the common interface (ViteRuntimeEnv)
    • cloudflare-pages: a Vite plugin that exposes ViteRuntimeEnv for cloudflare workerd using the actual workerd
    • vercel-edge: a Vite plugin that exposes ViteRuntimeEnv for edge-runtime using @edge-runtime/vm
    • example-framework: an example framework that uses ViteRuntimeEnv
  • examples
    • cloudflare-pages: an example using example-framework + cloudflare pages ViteRuntimeEnv plugin
    • vercel-edge: an example using example-framework + vercel edge ViteRuntimeEnv plugin

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published