Files
start9.com/site/server/vite.config.mts
2026-03-12 12:27:34 -06:00

40 lines
1.7 KiB
TypeScript

import { vendureDashboardPlugin } from '@vendure/dashboard/vite';
import { join, resolve } from 'path';
import { pathToFileURL } from 'url';
import { defineConfig } from 'vite';
export default defineConfig({
base: '/dashboard',
build: {
outDir: join(__dirname, 'dist/dashboard'),
},
plugins: [
vendureDashboardPlugin({
// The vendureDashboardPlugin will scan your configuration in order
// to find any plugins which have dashboard extensions, as well as
// to introspect the GraphQL schema based on any API extensions
// and custom fields that are configured.
vendureConfigPath: pathToFileURL('./src/vendure-config.ts'),
// Points to the location of your Vendure server.
// In production, 'auto' lets the dashboard derive the API URL from the
// server that serves it. In development, we use explicit defaults so that
// the Vite dev server can reach the Vendure backend.
api: process.env.NODE_ENV === 'production'
? { host: 'auto', port: 'auto' }
: { host: 'http://localhost', port: 3000 },
// When you start the Vite server, your Admin API schema will
// be introspected and the types will be generated in this location.
// These types can be used in your dashboard extensions to provide
// type safety when writing queries and mutations.
gqlOutputPath: './src/gql',
}),
],
resolve: {
alias: {
// This allows all plugins to reference a shared set of
// GraphQL types.
'@/gql': resolve(__dirname, './src/gql/graphql.ts'),
},
},
});