-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.js
90 lines (89 loc) · 2.58 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
85
86
87
88
89
90
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { VitePWA } from 'vite-plugin-pwa'
import svgrPlugin from 'vite-plugin-svgr'
import { splitVendorChunkPlugin } from 'vite'
// import emotionSwcPlugin from 'emotion-swc-plugin'
// https://vitejs.dev/config/
export default defineConfig({
build: {
sourcemap: true,
rollupOptions: {
// https://github.com/TanStack/query/issues/5175#issuecomment-1482196558
onwarn(warning, warn) {
if (warning.code === 'MODULE_LEVEL_DIRECTIVE') {
return
}
warn(warning)
},
},
},
plugins: [
splitVendorChunkPlugin(),
svgrPlugin({
include: '**/*.svg', // https://github.com/pd4d10/vite-plugin-svgr/issues/91#issuecomment-1732028802
svgrOptions: {
icon: true,
// ...svgr options (https://react-svgr.com/docs/options/)
},
}),
// need to NOT use complete path to src/images
// image files need to be in public instead
// https://vitejs.dev/guide/assets.html
VitePWA({
workbox: {
sourcemap: true,
globPatterns: [
'**/*.{js,jsx,ts,tsx,css,html,ico,png,jpg,svg,webp,json,woff2,woff}',
],
maximumFileSizeToCacheInBytes: 1000000000,
},
registerType: 'autoUpdate',
includeAssets: ['robots.txt'],
// https://developer.mozilla.org/en-US/docs/Web/Manifest
manifest: {
scope: '.',
name: 'apflora.ch',
short_name: 'apflora',
// https://web.dev/add-manifest/:
// Your start_url should direct the user straight into your app,
// rather than a product landing page.
// Think about what the user will want to do once they open your app,
// and place them there
start_url: './Daten',
background_color: '#256328',
theme_color: '#256328',
display: 'minimal-ui',
icons: [
{
src: '/ophr_192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: '/maskable_icon_x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
{
src: '/ophr_512.png',
sizes: '512x512',
type: 'image/png',
},
],
orientation: 'portrait',
description: 'Aktionspläne für Flora-Projekte',
},
// devOptions: {
// enabled: true,
// },
}),
react({
jsxImportSource: '@emotion/react',
babel: {
plugins: ['@emotion/babel-plugin'],
},
}),
],
})