import { fileURLToPath, URL } from 'node:url'; import { defineConfig } from 'vite'; import vue from '@vitejs/plugin-vue'; import AutoImport from 'unplugin-auto-import/vite'; import Components from 'unplugin-vue-components/vite'; import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'; import WindiCSS from 'vite-plugin-windicss'; //我在新建的项目这样完全没问题,就是这个项目有问题 // https://vitejs.dev/config/ export default defineConfig({ server: { host: '0.0.0.0', // 使用默认的IP地址 port: 5174, // 端口号保持不变,或者更改为其他端口 cors: true, // proxy: { // '/api2': { // target: 'http://coldverifylocal.coldbaozhida.com', // changeOrigin: true, // rewrite: (path) => path.replace(/^\/api2/, ''), // }, // }, }, base: './', resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)), }, }, plugins: [ vue(), WindiCSS(), AutoImport({ eslintrc: { enabled: true, }, imports: [ 'vue', 'vue-router', { 'naive-ui': [ 'useDialog', 'useMessage', 'useNotification', 'useLoadingBar', ], }, ], }), Components({ resolvers: [NaiveUiResolver()], }), ], build: { chunkSizeWarningLimit: 2000, outDir: '冷链2.0线下' }, });