Skip to Content

Vite

Status: keep Vite on Node.js for now. We tried the official react-ts template (Vite 8) and a minimal Vite 6 project.

What we tried

3va create vite vite-app --template react-ts # runs create-vite through npm cd vite-app 3va install --allow-net=registry.npmjs.org

1. The install almost passes the malware scanner. Vite, rolldown, TypeScript 6 and @types/node are accepted. Only the template’s linter is still rejected:

✗ oxlint@1.85.0 — install aborted by security scan

Review it and trust that exact version in package.json, "3va": { "trusted": ["oxlint@1.85.0"] }, or drop it from devDependencies. With the pin, it installed in our test.

2. Native binaries are installed. @rolldown/binding-linux-x64-gnu and lightningcss-linux-x64-gnu arrive as platform-specific optional dependencies (only the -gnu builds on a glibc system), and node_modules/.bin has vite, tsc and rolldown.

3. The Vite CLI doesn’t start under 3va:

$ 3va run node_modules/vite/bin/vite.js -- build Error: [parse] SyntaxError: Invalid or unexpected token

Importing Vite directly (import("vite")) fails with Cannot use 'import.meta' outside a module.

What about 3va dev?

3va dev is 3va’s own Vite-style dev server (on-demand ESM, TS/JSX transpiling, reload on save). It serves the Vite project’s files, but the React template doesn’t render in the browser:

Uncaught SyntaxError: The requested module '/node_modules/react/index.js' does not provide an export named 'useState'

React is published as CommonJS, and 3va dev doesn’t expose named ESM exports for CommonJS packages yet. Importing images (import hero from "./assets/hero.png") also breaks the initial bundle: stream did not contain valid UTF-8.

3va dev works well for plain TS/JS frontends that don’t depend on CommonJS packages (see example 06 and example 13).

A setup that works today

Keep the frontend toolchain on Node and move the rest:

package.json
{ "scripts": { "dev": "vite", "build": "vite build", "test": "3va test", "api": "3va run server/index.ts" } }
  • npm install / pnpm install for dependencies (native binaries included)
  • vite / vite build on Node for the frontend
  • 3va test for unit tests of pure logic
  • 3va run / 3va start for the backend the frontend talks to

Things to keep in mind

  • 3va create vite needs npm installed: it delegates to npm exec create-vite.
  • vite.config.ts plugins run inside Vite’s process, so they stay on Node too.
  • import.meta.env is undefined under 3va dev: import.meta.env?.MODE and ?.DEV both came back empty. It injects a process.env.NODE_ENV shim instead, and VITE_* variables aren’t exposed.