npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pitlane/vite-plugin-fetch-server

v0.1.0

Published

Vite development server bridge that sends requests to an app's Fetch handler.

Readme

@pitlane/vite-plugin-fetch-server

Serve vite dev requests through the Fetch handler your server module exports.

fetchServer({ entry }) sends every request Vite does not answer itself to the fetch method of entry's default export. The module is loaded through Vite's module runner on each request, so it is transformed like the rest of your app and an edit takes effect on the next request without a restart. It works with any framework, or none: all it needs is a module exporting { fetch }.

// src/http.ts
export default {
    async fetch(request: Request): Promise<Response> {
        return new Response(`You asked for ${new URL(request.url).pathname}`);
    },
};
// vite.config.ts
import { fetchServer } from "@pitlane/vite-plugin-fetch-server";
import { defineConfig } from "vite";

export default defineConfig({
    plugins: [fetchServer({ entry: "src/http.ts" })],
});

Install

npm install --save-dev @pitlane/vite-plugin-fetch-server
# or
vp add -D @pitlane/vite-plugin-fetch-server

Requires vite@>=8.1.0 as a peer.

fetchServer(options)

| Option | Default | Meaning | | --- | --- | --- | | entry | none, required | Path to the server module. Never inferred from build inputs. | | environment | "ssr" | The Vite environment that loads entry. It must be runnable, running its modules inside the dev server process. |

  • Development only. The plugin does nothing during vite build or vite preview and opens no port of its own.
  • A fallback. Files in public/, modules the browser requests, and other plugins' middleware come first. The plugin sets appType: "custom" unless your config sets one.
  • Requests and responses as sent. The URL, including the Vite base, plus the method, headers, body, status, repeated headers, and streamed bodies pass through unchanged. A client disconnect aborts request.signal and cancels a streaming body. Forwarded headers are not trusted.
  • Errors go to Vite. A throwing handler, a module that fails to load, or a default export without fetch produces Vite's development error page and an Internal server error: log line.
  • Configuration errors stop startup. A missing or empty entry, an environment that does not exist, and a non-runnable environment, such as Cloudflare's, each fail with a message. Leave the plugin out where a runtime integration serves requests itself.

With @pitlane/assets

// vite.config.ts
import { assets } from "@pitlane/assets/vite-plugin";
import { fetchServer } from "@pitlane/vite-plugin-fetch-server";
import { defineConfig } from "vite";

export default defineConfig({
    environments: {
        client: { build: { outDir: "dist/client" } },
        ssr: {
            build: {
                outDir: "dist/server",
                rolldownOptions: { input: "src/http.ts" },
            },
        },
    },
    plugins: [assets(), fetchServer({ entry: "src/http.ts" })],
});

The Fetch server guide covers the full behavior.