vite.config.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { defineConfig } from 'vite';
  2. import vue from '@vitejs/plugin-vue';
  3. import vueJsx from '@vitejs/plugin-vue-jsx';
  4. import Components from 'unplugin-vue-components/vite';
  5. import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
  6. import viteESLint from 'vite-plugin-eslint';
  7. // eslint-disable-next-line @typescript-eslint/no-var-requires
  8. const path = require('path');
  9. function resolve(dir: string) {
  10. return path.join(__dirname, dir);
  11. }
  12. // https://vitejs.dev/config/
  13. // https://github.com/vitejs/vite/issues/1930 .env
  14. // const proxyUrl = 'https://dev.kt.colexiu.com/';
  15. const proxyUrl = 'https://test.lexiaoya.cn';
  16. export default defineConfig({
  17. base: './',
  18. plugins: [
  19. vue(),
  20. vueJsx(),
  21. viteESLint(),
  22. Components({
  23. dts: true,
  24. resolvers: [NaiveUiResolver()]
  25. })
  26. ],
  27. resolve: {
  28. alias: {
  29. '@': resolve('./src'),
  30. '@common': resolve('./src/common'),
  31. '@components': resolve('./src/components'),
  32. '@store': resolve('./src/store'),
  33. '@views': resolve('./src/views')
  34. }
  35. },
  36. server: {
  37. host: '0.0.0.0',
  38. port: 5002,
  39. strictPort: true,
  40. cors: true,
  41. https: false,
  42. proxy: {
  43. '/api-oauth': {
  44. target: proxyUrl,
  45. changeOrigin: true
  46. }
  47. }
  48. }
  49. });