vite.config.ts 950 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import { resolve } from 'path'
  4. // https://vitejs.dev/config/
  5. export default defineConfig({
  6. plugins: [vue()],
  7. resolve: {
  8. alias: { //
  9. '@': resolve(__dirname, 'src'),
  10. //remove i18n waring
  11. },
  12. // why remove it , look for https://github.com/vitejs/vite/issues/6026
  13. // extensions: ['.js', '.ts', '.jsx', '.tsx', '.json', '.vue', '.mjs']
  14. },
  15. server: {
  16. host: '0.0.0.0',
  17. open: true,
  18. proxy: {
  19. // 跨域前缀写法
  20. '/api': {
  21. target: 'http://localhost:5000',
  22. changeOrigin: true,
  23. rewrite: (path) => path.replace(/^\/api/, ''),
  24. },
  25. },
  26. },
  27. css: {
  28. preprocessorOptions: {
  29. scss: {
  30. additionalData: "@import '@/assets/scss/_index.scss';",
  31. },
  32. },
  33. },
  34. })
  35. // function __dirname(__dirname: any, arg1: string): string {
  36. // throw new Error('Function not implemented.')
  37. // }