-
Notifications
You must be signed in to change notification settings - Fork 6
/
vite.config.js
84 lines (83 loc) · 2.02 KB
/
vite.config.js
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
import { defineConfig } from 'vite';
import preact from '@preact/preset-vite';
import legacy from '@vitejs/plugin-legacy';
import { VitePWA } from 'vite-plugin-pwa';
export default defineConfig({
plugins: [
preact(),
legacy(),
VitePWA({
injectRegister: 'inline',
strategies: 'injectManifest',
srcDir: '.',
filename: 'sw.js',
manifest: {
name: 'Check Weather SG',
short_name: '☀️🌧🇸🇬',
description: ' Yet another weather app for Singapore',
display: 'standalone',
background_color: '#343332',
theme_color: '#343332',
scope: '/',
start_url: '/',
icons: [
{
src: 'icons/maskable-icon.png',
sizes: '196x196',
type: 'image/png',
purpose: 'any maskable',
},
{
src: 'icons/icon-192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: 'icons/icon-512.png',
sizes: '512x512',
type: 'image/png',
},
],
screenshots: [
{
src: 'screenshots/1.jpg',
type: 'image/jpg',
sizes: '640x1136',
},
{
src: 'screenshots/2.jpg',
type: 'image/jpg',
sizes: '640x1136',
},
],
orientation: 'any',
categories: ['weather', 'rain', 'rainfall', 'singapore', 'map'],
},
}),
],
server: {
host: true,
hmr: false,
port: 8082,
},
build: {
minify: 'terser', // https://github.com/vitejs/vite/pull/5168
sourcemap: true,
assetsInlineLimit: 0,
terserOptions: {
format: {
comments: false,
},
},
rollupOptions: {
output: {
manualChunks: (id) => {
// console.log(id);
if (id.includes('maplibre-gl')) return 'maplibre-gl';
if (id.includes('node_modules')) return 'vendor';
return undefined;
},
},
},
},
});