Skip to content

TencentEdgeOne/vite-adapter

Repository files navigation

EdgeOne Vite Adapters

License: MIT Node.js Vite

English | 简体中文

Vite adapters for deploying SSR and SPA applications to EdgeOne Makers.

Features

  • Zero-config deployment to EdgeOne Makers
  • Automatic build artifact detection and bundling
  • Server code bundling with NFT dependency tracing
  • Route-aware config.json generation (Build Output API v3)
  • pnpm monorepo support
  • ESM interop handling for complex framework dependencies

Installation

# npm
npm install -D @edgeone/vite

# pnpm
pnpm add -D @edgeone/vite

# yarn
yarn add -D @edgeone/vite

Framework-specific adapters are also available:

# React Router v7
npm install -D @edgeone/react-router

# TanStack Start
npm install -D @edgeone/tanstack-start

Prerequisites

  • Node.js >= 18
  • Vite ^5.0.0 || ^6.0.0 || ^7.0.0

Quick Start

Native Vite (SPA / SSR)

// vite.config.ts
import { defineConfig } from "vite";
import edgeoneViteAdapter from "@edgeone/vite";

export default defineConfig({
  plugins: [
    edgeoneViteAdapter({
      ssr: true, // set to false for SPA-only
    }),
  ],
});

React Router v7

// vite.config.ts
import { reactRouter } from "@react-router/dev/vite";
import { defineConfig } from "vite";
import edgeoneReactRouterAdapter from "@edgeone/react-router";

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

TanStack Start

// vite.config.ts
import { defineConfig } from "vite";
import { TanStackStart } from "@tanstack/react-start/plugin/vite";
import edgeoneTanStackStartAdapter from "@edgeone/tanstack-start";

export default defineConfig({
  plugins: [
    TanStackStart(),
    edgeoneTanStackStartAdapter(),
  ],
});

After building (vite build), deploy the .edgeone/ output directory to EdgeOne Makers.

Packages

Package Version Description
@edgeone/vite-core npm Core plugin: build artifact handling, bundling, config generation
@edgeone/vite npm Base adapter for native Vite (SPA/SSR/Vike)
@edgeone/react-router npm React Router v7 adapter
@edgeone/tanstack-start npm TanStack Start adapter

Development

This repository is a pnpm workspace. npm and yarn are not supported for local development (a preinstall guard will reject them).

# Install dependencies (requires pnpm; Node.js >= 18, recommended 20)
pnpm install

# Build all packages
pnpm build

# Clean build artifacts
pnpm run clean

Contributing

Contributions are welcome! Please open a GitHub Issue or submit a Pull Request.

Links

License

MIT

About

Vite adapters for deploying SSR/SPA apps to EdgeOne Pages. Zero-config build artifact detection, NFT server bundling, and route-aware config.json. Supports native Vite, React Router v7, and TanStack Start.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors