عکس Aslemammad
🔥Building Cloudflare workers is faster and easier using vite-plugin-cloudflare with node builtins like process and streamJavaScript
موضوع‌ها
۲
فورک‌ها
۵
ستاره‌ها
۱۲۴
تاریخ ایجاد
۲۴ آذر ۱۴۰۰
آخرین بروزرسانی
۱ روز قبل
لایسنس
MIT License

vite-plugin-cloudflare 🔥

Vite-plugin-cloudflare is a software for transforming & bundling cloudflare workers with shimming node globals and builtins like process, os, stream and plenty of other node functions and modules using Esbuild and Vite!

  • ⚡ Lightning builds
  • 💥 Workers compatible build using shimming
  • 🔥 Fast development incremental reloads
  • ✏️ Easy simulation using Miniflare

Install

npm install -D vite-plugin-cloudflare

Build

vite-plugin-cloudflare build input.ts worker.js 
# or 
vpc build input.ts worker.js 

Now you can upload or use the worker.js file as your cloudflare worker file.

Development

 vpc dev input.ts 

Here you can navigate to localhost:3000 and see the output of your worker. With every change to the related files, Esbuild is going to rebuild incrementally through the Vite server, then Miniflare reloads the script so you can check the new results by refreshing your browser or reloading your client.

image_2021-12-28_22-53-23

More

For seeing more options:

vpc -h

And more examples in test/.

New features

  • ?raw support like vitejs
  • __STATIC_CONTENT_MANIFEST as external

Credits

Brillout

Viteflare

Cloudflare

Miniflare

Vitest

Node-builtins

Cac