🚀 Launch Week Day 5:Introducing Immutable Scans.Learn More →
Socket
Book a DemoInstallSign in
Socket

@edgeone/react-router

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@edgeone/react-router

EdgeOne adapter plugin for React Router

npmnpm
Version
1.0.1
Version published
Weekly downloads
9
-18.18%
Maintainers
3
Weekly downloads
 
Created
Source

@edgeone/react-router

EdgeOne adapter plugin for React Router - Automatically converts React Router build output to EdgeOne deployment format with zero configuration.

Features

  • âś… Automatic Asset Migration - Copies build/client to .edgeone/assets
  • âś… Server Bundling - Bundles server code into a single file (SSR mode)
  • âś… Route Metadata Generation - Generates meta.json configuration
  • âś… Multi-Mode Support - CSR, SSR, and Hybrid (SSR + Prerender)
  • âś… Tree-Shaking - Removes unused code automatically
  • âś… Zero External Dependencies - Bundled file requires only Node.js built-ins

Installation

npm install @edgeone/react-router --save-dev

Quick Start

Add the plugin to vite.config.ts:

import { reactRouter } from "@react-router/dev/vite";
import { edgeoneAdapter } from "@edgeone/react-router";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [reactRouter(), edgeoneAdapter()],
});

Build your project:

npm run build

Output structure:

.edgeone/
├── assets/              # Static assets
├── server-handler/      # Server code (SSR only)
│   └── index.mjs       # Single-file server
└── meta.json           # Route metadata

Rendering Modes

CSR (Client-Side Rendering)

Configure in react-router.config.ts:

export default { ssr: false } satisfies Config;

Deploy to any static hosting:

npx serve .edgeone/assets

SSR (Server-Side Rendering)

Configure in react-router.config.ts:

export default { ssr: true } satisfies Config;

Run locally:

node .edgeone/server-handler/index.mjs
# Server at http://localhost:9000

Hybrid (SSR + Prerender)

export default {
  ssr: true,
  async prerender() {
    return ["/", "/about"];
  },
} satisfies Config;

Deployment

EdgeOne Platform

edgeone pages deploy

Learn more about EdgeOne CLI.

Build Process

The adapter uses esbuild to bundle the server with the following optimizations:

  • Platform: Node.js 18+
  • Format: ESM
  • Tree-shaking: Enabled
  • External: Node.js built-in modules only
  • Bundle size: ~1.88 MB (includes React, React Router, and all dependencies)

Requirements

  • Node.js >= 18.0.0
  • Vite >= 5.0.0
  • React Router >= 7.0.0

License

MIT

Keywords

vite

FAQs

Package last updated on 18 Nov 2025

Did you know?

Socket

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.

Install

Related posts