vite.config.ts 782 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { defineConfig } from 'vite';
  2. import vue from '@vitejs/plugin-vue';
  3. import path from 'path';
  4. import dotenv from 'dotenv';
  5. import VueI18n from '@intlify/unplugin-vue-i18n/vite';
  6. // 加载环境变量
  7. dotenv.config();
  8. interface ImportMetaEnv {
  9. readonly VITE_API_URL: string; // 示例环境变量
  10. }
  11. interface ImportMeta {
  12. readonly env: ImportMetaEnv;
  13. }
  14. export default defineConfig({
  15. plugins: [
  16. vue(),
  17. VueI18n({
  18. include: path.resolve(__dirname, './src/locales/**'),
  19. }),
  20. ],
  21. resolve: {
  22. alias: {
  23. '@': path.resolve(__dirname, './src'),
  24. },
  25. },
  26. optimizeDeps: {
  27. include: ['quill'],
  28. },
  29. define: {
  30. //__API_URL__: JSON.stringify(process.env.VITE_API_URL),
  31. },
  32. });