vite.config.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { defineConfig } from "vite";
  2. import vue from "@vitejs/plugin-vue";
  3. import tailwindcss from 'tailwindcss';
  4. import autoprefixer from 'autoprefixer';
  5. import path from 'path';
  6. import Icons from "unplugin-icons/vite";
  7. const host = process.env.TAURI_DEV_HOST;
  8. // https://vitejs.dev/config/
  9. export default defineConfig(async () => ({
  10. plugins: [
  11. vue(),
  12. Icons({})
  13. ],
  14. css: {
  15. postcss: {
  16. plugins: [
  17. tailwindcss,
  18. autoprefixer,
  19. ],
  20. },
  21. },
  22. resolve: {
  23. alias: {
  24. '@': path.resolve(__dirname, './src')
  25. }
  26. },
  27. // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
  28. //
  29. // 1. prevent vite from obscuring rust errors
  30. clearScreen: false,
  31. // 2. tauri expects a fixed port, fail if that port is not available
  32. server: {
  33. port: 1420,
  34. strictPort: true,
  35. host: host || false,
  36. hmr: host
  37. ? {
  38. protocol: "ws",
  39. host,
  40. port: 1421,
  41. }
  42. : undefined,
  43. watch: {
  44. // 3. tell vite to ignore watching `src-tauri`
  45. ignored: ["**/src-tauri/**"],
  46. },
  47. },
  48. }));