vite.config.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import { viteMockServe } from 'vite-plugin-mock'
  4. import components from 'unplugin-vue-components/vite'
  5. import { VantResolver } from 'unplugin-vue-components/resolvers'
  6. import eslintPlugin from 'vite-plugin-eslint'
  7. // https://vitejs.dev/config/
  8. export default ({ command }) => defineConfig({
  9. css: {
  10. preprocessorOptions: {
  11. scss: {
  12. silenceDeprecations: ['legacy-js-api']
  13. },
  14. },
  15. },
  16. plugins: [
  17. vue(),
  18. viteMockServe({
  19. mockPath: 'mock',
  20. localEnabled: command === 'serve',
  21. }),
  22. components({
  23. resolvers: [VantResolver()]
  24. }),
  25. eslintPlugin()
  26. ],
  27. resolve: {
  28. alias: {
  29. '@': '/src'
  30. }
  31. },
  32. server: {
  33. host: "0.0.0.0",
  34. port: 1992,
  35. // proxy: {
  36. // '/api': {
  37. // target: 'http://127.0.0.1:2020',
  38. // changeOrigin: true,
  39. // rewrite: (path) => path.replace('/api', '')
  40. // }
  41. // }
  42. }
  43. })