[]previous and next page

dusk

The Vite plugins of a Dusk app, in the order they must run: 1.

The Vite plugins of a Dusk app, in the order they must run:

  1. the server-function transform (stubs in the browser build, registration on the server);
  2. the file-route plugin (scanner, routeTree.gen.ts, route splitting);
  3. the core plugin (virtual entries, dev server, build orchestration, prerender);
  4. import protection (server-only code cannot reach the browser);
  5. the ShadowJS compiler.

vite dev serves pages through the app's handler with HMR. vite build --app builds the browser bundle, then the server bundle, writes dist/dusk-manifest.json and prerenders.

Import#

ts
import { dusk } from "@shadow-js/dusk/vite";

Signature#

ts
function dusk(options: DuskOptions = {}): Plugin[]

Parameters#

Name Description
options See DuskOptions. All optional.

Returns#

An array of Vite plugins.

Throws#

  • TypeError for an unknown or invalid option (with a suggestion).

Examples#

ts
// vite.config.ts
import { dusk } from "@shadow-js/dusk/vite";
export default { plugins: [dusk()] };