vite.config.mts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { defineConfig } from 'vite';
  2. import * as path from 'path';
  3. import react 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. optimizeDeps: {
  27. include: ['@emotion/react', '@emotion/styled'],
  28. },
  29. plugins: [
  30. react(),
  31. svgr({
  32. // A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should include.
  33. include: '**/*.svg?react',
  34. // A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should ignore. By default no files are ignored.
  35. exclude: '',
  36. }),
  37. ],
  38. resolve: {
  39. // extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json"],
  40. alias: {
  41. '@': path.resolve(__dirname, './src'),
  42. // be careful to include server modules in the client
  43. '@server': path.resolve(__dirname, './../server/src'),
  44. },
  45. },
  46. });