123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- const path = require("path");
- import { defineConfig } from "vite";
- import vue from "@vitejs/plugin-vue";
- import { VitePWA } from "vite-plugin-pwa";
- import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
- const vueJsx = require("@vitejs/plugin-vue-jsx");
- const legacy = require("@vitejs/plugin-legacy");
- const proxyUrl = "https://test.dayaedu.com/"; // test 环境
- // const proxyUrl = "https://online.dayaedu.com/"; // test 环境
- // https://vitejs.dev/config/
- export default defineConfig({
- base: "./",
- // '/src': resolve(__dirname, './src')
- resolve: {
- alias: {
- // '/src': path.resolve(__dirname, './src'),
- },
- },
- css: {
- preprocessorOptions: {
- // less: {
- // lessOptions: {
- // modifyVars: {
- // '@blue': '#01A79E',
- // '@nav-bar-icon-color': '#01A79E'
- // }
- // }
- // }
- },
- },
- plugins: [
- createSvgIconsPlugin({
- // 指定需要缓存的图标文件夹
- iconDirs: [path.resolve(process.cwd(), "src/icons")],
- // 指定symbolId格式
- symbolId: "icon-[dir]-[name]",
- customDomId: "__svg__icons__dom__",
- }),
- vue(),
- vueJsx(),
- legacy({
- targets: ["> 0.25%, not dead"],
- ignoreBrowserslistConfig: true,
- }),
- // VitePWA({
- // injectRegister: "auto",
- // workbox: {
- // cleanupOutdatedCaches: true
- // },
- // base: './',
- // manifest: {
- // name: '管乐迷',
- // short_name: '管乐迷',
- // theme_color: '#01C1B5',
- // icons: [
- // {
- // src: './pwa-192x192.png',
- // sizes: '192x192',
- // type: 'image/png',
- // },
- // {
- // src: './pwa-512x512.png',
- // sizes: '512x512',
- // type: 'image/png',
- // },
- // ],
- // },
- // })
- ],
- server: {
- host: "0.0.0.0",
- cors: true,
- proxy: {
- "/api-im": {
- target: proxyUrl,
- changeOrigin: true,
- },
- "/api-web": {
- target: proxyUrl,
- changeOrigin: true,
- },
- "/api-auth": {
- target: proxyUrl,
- changeOrigin: true,
- },
- "/api-teacher": {
- target: proxyUrl,
- changeOrigin: true,
- },
- },
- },
- });
|