vite.config.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { fileURLToPath, URL } from 'node:url';
  2. import { defineConfig } from 'vite';
  3. import vue from '@vitejs/plugin-vue';
  4. import AutoImport from 'unplugin-auto-import/vite';
  5. import Components from 'unplugin-vue-components/vite';
  6. import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
  7. import WindiCSS from 'vite-plugin-windicss';
  8. //我在新建的项目这样完全没问题,就是这个项目有问题
  9. // https://vitejs.dev/config/
  10. export default defineConfig({
  11. server: {
  12. host: '0.0.0.0', // 使用默认的IP地址
  13. port: 5174, // 端口号保持不变,或者更改为其他端口
  14. cors: true,
  15. // proxy: {
  16. // '/api2': {
  17. // target: 'http://coldverifylocal.coldbaozhida.com',
  18. // changeOrigin: true,
  19. // rewrite: (path) => path.replace(/^\/api2/, ''),
  20. // },
  21. // },
  22. },
  23. base: './',
  24. resolve: {
  25. alias: {
  26. '@': fileURLToPath(new URL('./src', import.meta.url)),
  27. },
  28. },
  29. plugins: [
  30. vue(),
  31. WindiCSS(),
  32. AutoImport({
  33. eslintrc: {
  34. enabled: true,
  35. },
  36. imports: [
  37. 'vue',
  38. 'vue-router',
  39. {
  40. 'naive-ui': [
  41. 'useDialog',
  42. 'useMessage',
  43. 'useNotification',
  44. 'useLoadingBar',
  45. ],
  46. },
  47. ],
  48. }),
  49. Components({
  50. resolvers: [NaiveUiResolver()],
  51. }),
  52. ],
  53. build: {
  54. chunkSizeWarningLimit: 2000,
  55. outDir: '冷链2.0线下'
  56. },
  57. });