vite.config.template.mts 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { vendureDashboardPlugin } from '@vendure/dashboard/vite';
  2. import { join, resolve } from 'path';
  3. import { pathToFileURL } from 'url';
  4. import { defineConfig } from 'vite';
  5. export default defineConfig({
  6. base: '/dashboard',
  7. build: {
  8. outDir: join(__dirname, 'dist/dashboard'),
  9. },
  10. plugins: [
  11. vendureDashboardPlugin({
  12. // The vendureDashboardPlugin will scan your configuration in order
  13. // to find any plugins which have dashboard extensions, as well as
  14. // to introspect the GraphQL schema based on any API extensions
  15. // and custom fields that are configured.
  16. vendureConfigPath: pathToFileURL('./src/vendure-config.ts'),
  17. // Points to the location of your Vendure server.
  18. api: { host: 'http://localhost', port: 3000 },
  19. // When you start the Vite server, your Admin API schema will
  20. // be introspected and the types will be generated in this location.
  21. // These types can be used in your dashboard extensions to provide
  22. // type safety when writing queries and mutations.
  23. gqlOutputPath: './src/gql',
  24. }),
  25. ],
  26. resolve: {
  27. alias: {
  28. // This allows all plugins to reference a shared set of
  29. // GraphQL types.
  30. '@/gql': resolve(__dirname, './src/gql/graphql.ts'),
  31. },
  32. },
  33. });