VendureDashboardPlugin
This is the Vite plugin which powers the Vendure Dashboard, including:
- Configuring routing, styling and React support
- Analyzing your VendureConfig file and introspecting your schema
- Loading your custom Dashboard extensions
Parameters
options
VitePluginVendureDashboardOptionsOptions for the vendureDashboardPlugin Vite plugin.
The PathAdapter interface allows customization of how paths are handled when compiling the Vendure config and its imports.
It enables support for more complex repository structures, such as monorepos, where the Vendure server configuration file may not be located in the root directory of the project.
If you get compilation errors like "Error loading Vendure config: Cannot find module",
you probably need to provide a custom pathAdapter to resolve the paths correctly.
This can take some trial-and-error. Try logging values from the functions to figure out the exact settings that you need for your repo setup.
Example
getCompiledConfigPath
GetCompiledConfigPathFnA function to determine the path to the compiled Vendure config file.
transformTsConfigPathMappings
TransformTsConfigPathMappingsFnsourceRoot
stringv3.6.0The root directory used to compute relative output paths when compiling TypeScript files. Compiled files preserve their directory structure relative to this root.
In monorepos this should typically be set to the workspace root (where
the base tsconfig.json lives), so that a config file at
apps/server/src/vendure-config.ts outputs to
{outputPath}/apps/server/src/vendure-config.js.
Defaults to the directory containing the vendureConfigPath file,
which places the compiled config at the output root.
Options used by the vendureDashboardPlugin to configure how the Dashboard connects to the Vendure Admin API
host
string | 'auto''auto'The hostname of the Vendure server which the admin UI will be making API calls
to. If set to "auto", the Admin UI app will determine the hostname from the
current location (i.e. window.location.hostname).
port
number | 'auto''auto'The port of the Vendure server which the admin UI will be making API calls
to. If set to "auto", the Admin UI app will determine the port from the
current location (i.e. window.location.port).
adminApiPath
string'admin-api'The path to the GraphQL Admin API.
tokenMethod
'cookie' | 'bearer''cookie'Whether to use cookies or bearer tokens to track sessions.
Should match the setting of in the server's tokenMethod config
option.
authTokenHeaderKey
string'vendure-auth-token'The header used when using the 'bearer' auth method. Should match the
setting of the server's authOptions.authTokenHeaderKey config option.
channelTokenKey
string'vendure-token'The name of the header which contains the channel token. Should match the
setting of the server's apiOptions.channelTokenKey config option.
Options used by the vendureDashboardPlugin to configure aspects of the Dashboard UI behaviour.
defaultLanguage
LanguageCode<a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>.enThe default language for the Admin UI. Must be one of the
items specified in the availableLanguages property.
defaultLocale
stringv2.2.0The default locale for the Admin UI. The locale affects the formatting of
currencies & dates. Must be one of the items specified
in the availableLocales property.
If not set, the browser default locale will be used.
availableLanguages
LanguageCode[]An array of languages for which translations exist for the Admin UI.
availableLocales
string[]v2.2.0An array of locales to be used on Admin UI.
Options used by the vendureDashboardPlugin to configure order-related Dashboard UI behaviour.
refundReasons
Array<{ value: string; label: string }>An array of refund reasons to display in the refund order dialog.
Each reason has a value (used as the identifier) and a label (displayed to the user).
If not provided, default reasons will be used.
Options used by the vendureDashboardPlugin to configure aspects of the Dashboard UI behaviour.
api
ApiConfigConfiguration for API connection settings
i18n
I18nConfigConfiguration for internationalization settings
orders
OrdersConfigConfiguration for order-related settings