This plugin serves the static files of the Vendure Dashboard and provides the GraphQL extensions needed for the order metrics on the dashboard index page.
npm install @vendure/dashboard
First you need to set up compilation of the Dashboard, using the Vite configuration described in the Dashboard Getting Started Guide
When developing, you can run npx vite (or npm run dev) to start the Vite development server.
The plugin will automatically detect if Vite is running on the default port (5173) and proxy
requests to it instead of serving static files. This enables hot module replacement and faster
development iterations.
For production, run npx vite build to build the dashboard app. The built app files will be
output to the location specified by build.outDir in your Vite config file. This should then
be passed to the appDir init option, as in the example below:
Example
This plugin defines a metricSummary query which is used by the Dashboard UI to
display the order metrics on the dashboard.
If you are building a stand-alone version of the Dashboard UI app, and therefore
don't need this plugin to serve the Dashboard UI, you can still use the
metricSummary query by adding the DashboardPlugin to the plugins array,
but without calling the init() method:
Example
(options: DashboardPluginOptions) => Type<DashboardPlugin>Set the plugin options
(consumer: MiddlewareConsumer) =>