| import { defineConfig } from 'vite' |
| import vue from '@vitejs/plugin-vue' |
| import { VitePWA } from 'vite-plugin-pwa' |
| import { resolve } from 'path' |
|
|
| export default defineConfig({ |
| base: '/', |
| plugins: [ |
| vue(), |
| VitePWA({ |
| registerType: 'autoUpdate', |
| includeAssets: ['favicon.svg', 'icons/apple-touch-icon.svg'], |
| manifest: { |
| name: '云音乐', |
| short_name: '云音乐', |
| description: 'PWA音乐播放器', |
| theme_color: '#ff6b6b', |
| background_color: '#0c0c0c', |
| display: 'standalone', |
| orientation: 'portrait-primary', |
| start_url: './', |
| scope: './', |
| icons: [ |
| { |
| src: 'icons/icon-72x72.svg', |
| sizes: '72x72', |
| type: 'image/svg+xml' |
| }, |
| { |
| src: 'icons/icon-96x96.svg', |
| sizes: '96x96', |
| type: 'image/svg+xml' |
| }, |
| { |
| src: 'icons/icon-128x128.svg', |
| sizes: '128x128', |
| type: 'image/svg+xml' |
| }, |
| { |
| src: 'icons/icon-192x192.svg', |
| sizes: '192x192', |
| type: 'image/svg+xml', |
| purpose: 'any maskable' |
| }, |
| { |
| src: 'icons/icon-512x512.svg', |
| sizes: '512x512', |
| type: 'image/svg+xml' |
| } |
| ] |
| }, |
| workbox: { |
| globPatterns: ['**/*.{js,css,html,ico,png,svg}'], |
| runtimeCaching: [ |
| { |
| urlPattern: /^https:\/\/music-api\.gdstudio\.xyz\/.*$/, |
| handler: 'NetworkFirst', |
| options: { |
| cacheName: 'music-api-cache', |
| expiration: { |
| maxEntries: 100, |
| maxAgeSeconds: 60 * 60 * 24 |
| } |
| } |
| } |
| ] |
| } |
| }) |
| ], |
| resolve: { |
| alias: { |
| '@': resolve(__dirname, 'src') |
| } |
| }, |
| server: { |
| port: 3000, |
| open: true, |
| cors: true, |
| |
| middlewareMode: false, |
| fs: { |
| strict: true, |
| allow: ['..'] |
| } |
| }, |
| build: { |
| target: 'es2015', |
| rollupOptions: { |
| output: { |
| manualChunks: { |
| 'vue-vendor': ['vue', 'vue-router', 'pinia'], |
| 'vueuse': ['@vueuse/core'] |
| } |
| } |
| } |
| } |
| }) |
|
|