-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvite.config.js
65 lines (61 loc) · 1.56 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
import { sveltekit } from '@sveltejs/kit/vite';
import { SvelteKitPWA } from '@vite-pwa/sveltekit';
import mkcert from 'vite-plugin-mkcert';
const pwaManifest = {
name: "Ionic SSR demo",
short_name: "IonicSSRDemo",
description: "Ionic SSR demo",
theme_color: '#f27649',
orientation: "portrait",
start_url: "/app/splash",
id: "/",
background_color: "#ffffff",
lang: "en",
icons: [
// The original 192x192 icon size was actually 512x512
{
src: "/android-chrome-192x192.png",
sizes: "192x192",
type: "image/png",
// Chrome DevTools recommends not using it
// "purpose": "maskable any"
},
{
sizes: "512x512",
src: "/android-chrome-512x512.png",
type: "image/png"
}
]
}
const pwaConfiguration = {
// None of this is required and builds are being executed just fine
// If "ouDir" is set vite is actually "dumping" generated files there
// that's why sw.js and so one were there
// outDir: './static',
// includeAssets: ['favicon.svg', 'favicon.ico', 'robots.txt', 'apple-touch-icon.png', 'dist/*'],
base: '/',
scope: '/',
manifest: pwaManifest
}
/** @type {import('vite').UserConfig} */
const config = {
define: {
'process.env.NODE_ENV': process.env.NODE_ENV === 'production'
? '"production"'
: '"development"'
},
plugins: [
sveltekit(),
// a plugin for enabling provisional certificate for https preview server
mkcert(),
SvelteKitPWA(pwaConfiguration)
],
// for service worker to work properly the PWA needs to be running on https protocol
preview: {
https: true
},
server: {
https: true
}
};
export default config;