-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
63 lines (61 loc) · 1.7 KB
/
Copy pathvite.config.ts
File metadata and controls
63 lines (61 loc) · 1.7 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
import path from 'node:path'
import tailwindcss from '@tailwindcss/vite'
import vikeLite from 'vike-lite/vite'
import vikeLiteSolid from 'vike-lite-solid/vite'
import { defineConfig, loadEnv } from 'vite'
export default defineConfig(async ({ mode }) => {
// Add ME_CONFIG_ env vars to process.env
Object.assign(process.env, loadEnv(mode, process.cwd(), 'ME_CONFIG_'))
return {
root: 'src',
cacheDir: '../.vite',
plugins: [
tailwindcss(),
vikeLite({
serverEntry: 'server/index.ts'
}),
vikeLiteSolid(),
...process.env.NODE_ENV === 'production' ? [
(await import('vite-plugin-pwa')).VitePWA({
registerType: 'autoUpdate', // Automatically updates the service worker
devOptions: {
// enabled: true, // Enable PWA in development mode
type: 'module'
},
manifest: {
name: 'Mongo Solid',
short_name: 'MongoSolid',
theme_color: '#3F51B5',
background_color: '#3367D6',
icons: [
{
src: '/icons/logo-192.png',
sizes: '192x192',
type: 'image/png'
}
]
}
}).map((plugin) => ({
...plugin,
// Prevent from generating registerSW.js inside /dist/server
applyToEnvironment(environment: { name: string }) {
return environment.name === 'client'
}
}))
] : []
],
server: {
port: 3000
},
build: {
outDir: '../dist',
minify: true
},
envPrefix: 'ME_CONFIG_',
resolve: {
alias: {
'@': path.resolve(import.meta.dirname, 'src')
}
}
}
})