A wannabe Vite for Deno
OTHER License
Haydi (pronounced "high-dee") is an experiment to create an on-demand dev server (like Vite) for Deno.
Open the playground/react
directory in your IDE and run deno task dev
to see it in action. It will compile the source files on demand, both for the server and the client and run a simple React SSR demo app.
Haydi has a plugin system (internal for now) inspired by Vite's. It uses plugins to resolve, load, and transform modules both for the server and the browser.
For the server-side code, modules are transformed into an async function body and executed. This will allow custom transforms (Vue, Svelte etc.) and hot loading later on. This will be dropped once Deno supports a native loader API.
For the client-side code, modules are transformed and sent to the browser on demand. Bare imports (e.g. import React from "react"
) are resolved using the import-map.browser.json
file and rewritten. Currently, they resolve to CDN versions. We can cache them locally later. Relying on a CDN (even if cached) skirts around the most complicated part of Vite (dependency optimization).