-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.js
More file actions
103 lines (102 loc) · 2.75 KB
/
vite.config.js
File metadata and controls
103 lines (102 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import { VitePWA } from 'vite-plugin-pwa'
// https://vite.dev/config/
export default defineConfig({
// Use relative base so the app works both on GitHub Pages (/Movie/) and Vercel root (/)
base: "./",
plugins: [
react(),
tailwindcss(),
VitePWA({
registerType: 'autoUpdate',
devOptions: {
enabled: true,
},
includeAssets: ['favicon.svg', 'favicon.ico', 'robots.txt', 'apple-touch-icon.png'],
manifest: {
name: 'Movie PWA',
short_name: 'Movie',
description: 'پلتفرم تماشای فیلم و سریال',
theme_color: '#020617',
background_color: '#020617',
display: 'standalone',
start_url: '/',
scope: '/',
lang: 'fa',
dir: 'rtl',
icons: [
{
src: 'icons/icon-192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: 'icons/icon-512.png',
sizes: '512x512',
type: 'image/png'
},
{
src: 'icons/maskable-icon-192.png',
sizes: '192x192',
type: 'image/png',
purpose: 'maskable'
},
{
src: 'icons/maskable-icon-512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable'
}
]
},
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,jpg,jpeg,json}'],
// Do not precache very large assets; they will still be served normally
// and cached at runtime by the image runtimeCaching rule below.
maximumFileSizeToCacheInBytes: 8 * 1024 * 1024, // 8 MiB
runtimeCaching: [
{
urlPattern: ({ url }) => url.origin === self.location.origin,
handler: 'CacheFirst',
options: {
cacheName: 'movie-static-cache',
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 60 * 24 * 30
}
}
},
{
urlPattern: ({ request }) => request.destination === 'image',
handler: 'CacheFirst',
options: {
cacheName: 'movie-image-cache',
expiration: {
maxEntries: 60,
maxAgeSeconds: 60 * 60 * 24 * 30
}
}
}
]
}
})
],
publicDir: 'public',
server: {
port: 5173,
strictPort: false,
host: 'localhost',
hmr: {
overlay: false
},
watch: {
usePolling: false
}
},
build: {
sourcemap: true,
chunkSizeWarningLimit: 1600
}
})