vite.config.ts
@@ -1,15 +1,20 @@ import { defineConfig } from 'vite'; import vue from '@vitejs/plugin-vue'; import path from 'path'; export default defineConfig({ plugins: [vue()], css: { postcss: path.resolve(__dirname, 'postcss.config.js') }, server: { port: 3034, // 指定端口号为 3000 strictPort: true, // 如果端口被占用,则抛出错误而不是尝试下一个可用端口 host: true // 允许通过ip访问,要不然平板测试不了 }, resolve: { alias: { '@': '/src' '@': path.resolve(__dirname, 'src') } } });