| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import { defineConfig } from 'vite';
- import vue from '@vitejs/plugin-vue';
- import vueDevTools from 'vite-plugin-vue-devtools';
- import path from 'path'; // 导入 path 模块
- // https://vitejs.dev/config/
- export default defineConfig({
- /**
- * 项目根目录
- * @see https://cn.vite.dev/config/shared-options.html#root
- */
- root: './src',
- /**
- * 静态资源目录,相对于 src/index.html 文件
- * @see https://cn.vite.dev/config/shared-options.html#publicdir
- */
- publicDir: '../public',
- server: {
- port: 5174,
- host: '0.0.0.0', // IP配置,支持从IP启动
- proxy: {
- '/api/': {
- // target: 'http://192.168.20.119:9601',
- target: 'http://192.168.20.72:9601',
- // target: 'https://192.168.20.119:26100',
- changeOrigin: true,
- secure: false,
- ws: true,
- cors: true,
- rewrite: (path) => path.replace(/^\/proxy_url/, '')
- }
- }
- },
- build: {
- /**
- * 构建输出目录,相对于 src/index.html 文件
- * @see https://cn.vite.dev/config/build-options.html#build-outdir
- */
- outDir: '../dist',
- emptyOutDir: true
- },
- resolve: {
- alias: {
- '@': path.resolve(__dirname, './src') // 配置@指向src目录
- }
- },
- plugins: [
- vue()
- /**
- * @see https://devtools.vuejs.org/guide/vite-plugin
- */
- // vueDevTools({
- // launchEditor: 'code'
- // })
- ]
- });
|