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
TransformTsConfigPathMappingsFnOptions 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 aspects of the Dashboard UI behaviour.
api
ApiConfigConfiguration for API connection settings
i18n
I18nConfigConfiguration for internationalization settings