12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- 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 = "http://dev.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: {
- cors: true,
- proxy: {
- '/api-web': {
- target: proxyUrl,
- changeOrigin: true
- },
- '/api-auth': {
- target: proxyUrl,
- changeOrigin: true
- },
- '/api-teacher': {
- target: proxyUrl,
- changeOrigin: true
- }
- }
- }
- });
|