1.0.1 • Published 21h ago
@r121/vite-runtime
Licence
UNLICENSED
Version
1.0.1
Deps
0
Size
31 kB
Vulns
0
Weekly
0
@r121/vite-runtime
Drop-in Vite defineConfig helper for hosted preview. When sandbox env is enabled, it applies fixed server/base/build settings in memory over the project's vite.config.ts.
Install
npm install -D @r121/vite-runtime
vite is a peerDependency (^5 || ^6). The project's package.json owns the Vite version.
Usage
import { defineConfig } from "@r121/vite-runtime";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
export default defineConfig({
base: "./", // overridden in sandbox via REG121_PREVIEW_BASE
plugins: [react(), tailwindcss()],
build: { outDir: "build", emptyOutDir: true },
});
With sandbox env unset: passthrough — your config is unchanged.
Sandbox environment
| Variable | Required | Meaning |
|---|---|---|
REG121_SANDBOX |
"1" |
Enable sandbox overrides |
REG121_APP_KIND |
frontend | admin |
Port (5173 / 5174) and plugins |
REG121_PREVIEW_BASE |
required for serve; optional for build (defaults /) |
Forced Vite base |
REG121_SITE_ID |
optional | Included in the ready JSON |
Example:
REG121_SANDBOX=1 \
REG121_APP_KIND=frontend \
REG121_PREVIEW_BASE=/preview/ \
./node_modules/.bin/vite --host 0.0.0.0 --port 5173 --strictPort
What sandbox mode forces
server.port+strictPort: true+host: 0.0.0.0basefromREG121_PREVIEW_BASE(or/on build when unset)build.outDir: "build",emptyOutDir: true- Strip
server.proxy,server.headers,server.cors, and Vitessr - Ready endpoint:
GET …/__reg121/ready - Frontend only: 404 for
/adminSPA fallback paths - Ensure
@tailwindcss/vitewhen that package is installed
License
UNLICENSED