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:
- the server-function transform (stubs in the browser build, registration on the server);
- the file-route plugin (scanner,
routeTree.gen.ts, route splitting); - the core plugin (virtual entries, dev server, build orchestration, prerender);
- import protection (server-only code cannot reach the browser);
- 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()] };