denoVite
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v63View latest version
A Vite project running on Val Town. The server.tsx
serves the project. If you make any edits the server will rebuild on the next request.
The vite build server is a proxy. Any request on the frontend is proxied to the build server:
const projectVal = parseProject(import.meta.url);
export default async function(req: Request): Promise<Response> {
const url = new URL(req.url);
const path = `/${projectVal.username}/${projectVal.name}@${projectVal.version}${url.pathname}`;
const proxyUrl = new URL(path, "https://vite-proxy.ng-demo.valtown.net").toString();
const response = await fetch(proxyUrl);
When a request is recieved, the proxy downloads the entire project source (it can't be private) and builds it using Deno. Once the build is complete, all resulting files are cached and served quickly for future requests.