vite.config.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { defineConfig } from "vite";
  2. import vue from "@vitejs/plugin-vue";
  3. import { VitePWA } from 'vite-plugin-pwa'
  4. import { hostname } from "os";
  5. const vueJsx = require('@vitejs/plugin-vue-jsx')
  6. const legacy = require('@vitejs/plugin-legacy')
  7. const proxyUrl = "https://test.dayaedu.com/"; // test 环境
  8. // https://vitejs.dev/config/
  9. export default defineConfig({
  10. base: "./",
  11. plugins: [
  12. vue(),
  13. vueJsx(),
  14. legacy({
  15. targets: ["> 0.25%, not dead"],
  16. ignoreBrowserslistConfig: true,
  17. }),
  18. VitePWA({
  19. injectRegister: "auto",
  20. workbox: {
  21. cleanupOutdatedCaches: true
  22. },
  23. base: './',
  24. manifest: {
  25. name: '管乐迷',
  26. short_name: '管乐迷',
  27. theme_color: '#01C1B5',
  28. icons: [
  29. {
  30. src: './pwa-192x192.png',
  31. sizes: '192x192',
  32. type: 'image/png',
  33. },
  34. {
  35. src: './pwa-512x512.png',
  36. sizes: '512x512',
  37. type: 'image/png',
  38. },
  39. ],
  40. },
  41. })
  42. ],
  43. server: {
  44. cors: true,
  45. proxy: {
  46. '/api-web': {
  47. target: proxyUrl,
  48. changeOrigin: true
  49. }
  50. }
  51. }
  52. });