vite.config.mts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { defineConfig } from 'vite';
  2. import * as path from 'path';
  3. import reactRefresh from '@vitejs/plugin-react';
  4. import svgr from 'vite-plugin-svgr';
  5. // https://vitejs.dev/config/
  6. export default defineConfig({
  7. base: '',
  8. // This changes the out put dir from dist to build
  9. // comment this out if that isn't relevant for your project
  10. build: {
  11. outDir: 'build',
  12. },
  13. server: {
  14. port: 3001,
  15. proxy: {
  16. '/api': {
  17. target: 'http://localhost:3000',
  18. changeOrigin: true,
  19. },
  20. '/socket.io': {
  21. target: 'http://localhost:3000',
  22. ws: true,
  23. },
  24. },
  25. },
  26. plugins: [
  27. reactRefresh(),
  28. svgr({
  29. // A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should include.
  30. include: '**/*.svg?react',
  31. // A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should ignore. By default no files are ignored.
  32. exclude: '',
  33. }),
  34. ],
  35. resolve: {
  36. // extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json"],
  37. alias: {
  38. '@': path.resolve(__dirname, './src'),
  39. // be careful to include server modules in the client
  40. '@server': path.resolve(__dirname, './../server/src'),
  41. },
  42. },
  43. });