-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.ts
80 lines (79 loc) · 2.23 KB
/
vite.config.ts
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
// vite define config
import { defineConfig } from 'vite'
// vite plugin
import UnoCSS from 'unocss/vite'
import { presetTagify, presetIcons } from 'unocss'
import extractorSvelte from '@unocss/extractor-svelte'
import { sveltekit } from '@sveltejs/kit/vite'
import { SvelteKitPWA } from '@vite-pwa/sveltekit'
// import { visualizer } from 'rollup-plugin-visualizer'
// postcss & tailwindcss
import TailwindCSS from 'tailwindcss'
import tailwindConfig from './tailwind.config'
import autoprefixer from 'autoprefixer'
import cssnano from 'cssnano'
export default defineConfig({
envPrefix: 'URARA_',
css: {
postcss: {
plugins: [
TailwindCSS(tailwindConfig as any) as any,
autoprefixer(),
...(process.env.NODE_ENV === 'production'
? [
cssnano({
preset: ['default', { discardComments: { removeAll: true } }]
})
]
: [])
]
}
},
plugins: [
UnoCSS({
content: {
pipeline: {
include: [/\.svelte$/, /\.md?$/, /\.ts$/],
}
},
extractors: [extractorSvelte],
presets: [
presetTagify({
extraProperties: (matched: string) => (matched.startsWith('i-') ? { display: 'inline-block' } : {})
}),
presetIcons({ scale: 1.5 })
]
}),
// VitePWA({
// srcDir: './build',
// outDir: './.svelte-kit/output/client',
// registerType: 'autoUpdate',
// base: '/',
// scope: '/',
// workbox: {
// dontCacheBustURLsMatching: /-[a-f0-9]{8}\./,
// globDirectory: './build/',
// globPatterns: ['robots.txt', '**/*.{js,css,html,ico,png,svg,webmanifest}'],
// globIgnores: ['**/sw*', '**/workbox-*']
// }
// }),
sveltekit(),
SvelteKitPWA({
outDir: '.svelte-kit/output/client',
registerType: 'autoUpdate',
manifest: false,
scope: '/',
workbox: {
globPatterns: ['robots.txt', 'posts.json', '**/*.{js,css,html,svg,ico,png,webp,avif}'],
globIgnores: ['**/sw*', '**/workbox-*', '*.xml', 'feed.json', 'tags.json']
},
kit: {
trailingSlash: 'always'
},
})
// visualizer({
// emitFile: true,
// file: 'stats.html'
// })
]
})