
Product
Announcing Precomputed Reachability Analysis in Socket
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
vite-plugin-serve-static
Advanced tools
A Vite plugin for serving static files during local development
A simple Vite plugin for serving arbitrary static files that aren't in your public
directory.
// vite.config.ts
import path from "path";
import { defineConfig } from "vite";
import serveStatic from "vite-plugin-serve-static";
const serveStaticPlugin = serveStatic([
{
pattern: /^\/metadata\.json/,
resolve: "./metadata.json",
},
{
pattern: /^\/dog-photos\/.*/,
resolve: ([match]) => path.join("..", "dog-photos", match),
},
{
pattern: /^\/author-photos\/(.*)/,
resolve: (groups) => path.join("..", "authors", groups[1]) + ".jpg",
},
]);
export default defineConfig({
plugins: [serveStaticPlugin],
});
The configuration is defined as an array of objects defining which patterns to intercept and how to resolve them.
Each pattern
is defined as a regular expression. The resolve
property can either be a string containing the path to a single file or a function that returns a string given the result of executing the pattern
against the request path.
Licensed under the MIT License.
FAQs
A Vite plugin for serving static files during local development
The npm package vite-plugin-serve-static receives a total of 2,790 weekly downloads. As such, vite-plugin-serve-static popularity was classified as popular.
We found that vite-plugin-serve-static demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.