123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- import { defineConfig, loadEnv } from "vite";
- import vue from "@vitejs/plugin-vue";
- import path from "path";
- import AutoImport from "unplugin-auto-import/vite";
- import Components from "unplugin-vue-components/vite";
- import { TDesignResolver } from "unplugin-vue-components/resolvers";
- import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
- import zipBuildPlugin from './zipBuildPlugin';
- import vueJsx from '@vitejs/plugin-vue-jsx';
- export default defineConfig(({ mode }) => {
- const ENV = loadEnv(mode, process.cwd());
- return {
- base: ENV.VITE_APP_BASE_URL,
- plugins: [
- vue(),
- vueJsx(),
- AutoImport({
-
- imports: ["vue"],
- dirs: ["./src/plugin"],
- resolvers: [
- TDesignResolver({
- library: "vue-next",
- }),
- ],
- dts: "src/auto-imports.d.ts",
- }),
- Components({
- resolvers: [
- TDesignResolver({
- library: "vue-next",
- }),
-
-
- {
- type: 'directive',
- resolve: (name) => {
- if (name === 'Loading') {
- return {
- name: 'vLoading',
- from: `tdesign-vue-next/esm/loading/directive`
- };
- } else {
- return;
- }
- },
- }
- ],
- directives: true
- }),
- createSvgIconsPlugin({
-
- iconDirs: [path.resolve(process.cwd(), "src/assets/svg")],
-
- symbolId: "[name]",
-
-
-
-
- }),
- zipBuildPlugin()
- ],
- css: {
-
- preprocessorOptions: {
- scss: {
-
-
- additionalData: `@import '@/styles/var.scss';`,
- },
- },
- },
- resolve: {
- alias: {
- "@": path.resolve(__dirname, "./src"),
- },
- },
- build: {
- outDir: ENV.VITE_APP_OUTDIR,
- },
- server:{
- port:8901,
- proxy:{
- '/v1': {
- target: 'http://8.136.199.33:8901/v1',
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/v1/, ''),
- }
- }
- }
- };
- });
|