1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import { defineConfig, loadEnv } from "vite";
- import vue from "@vitejs/plugin-vue";
- import path from "path";
- import Components from "unplugin-vue-components/vite";
- import AutoImport from "unplugin-auto-import/vite";
- import { VantResolver } from "unplugin-vue-components/resolvers";
- import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
- export default ({ mode }) =>
- defineConfig({
- // base: loadEnv(mode, process.cwd()).VITE_APP_BASE_URL,
- plugins: [
- vue(),
- AutoImport({
- resolvers: [ElementPlusResolver()],
- }),
- Components({
- resolvers: [VantResolver(), ElementPlusResolver()],
- }),
- ],
- resolve: {
- alias: {
- "@": path.resolve(__dirname, "./src"),
- },
- },
- server: {
- port: 8888,
- cors: true,
- host: "0.0.0.0",
- proxy: {
- "/api": {
- target: loadEnv(mode, process.cwd()).VITE_APP_CYGX_BASEAPIURL,
- //target: 'https://cygxpctest.hzinsights.com',
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/api/, "/api"),
- },
- },
- },
- build: {
- outDir: loadEnv(mode, process.cwd()).VITE_APP_OUTDIR,
- },
- });
|