forked from satisfactorymodding/smr-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
65 lines (62 loc) · 1.54 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 terser from '@rollup/plugin-terser';
import { purgeCss } from 'vite-plugin-tailwind-purgecss';
const mode = process.env.NODE_ENV || 'development';
const dev = mode === 'development' || process.env.RUNTIME === 'development';
process.env.TAILWIND_MODE = dev ? 'watch' : 'build';
/** @type {import('vite').UserConfig} */
const config = {
plugins: [sveltekit(), purgeCss()],
server: {
port: 3000,
strictPort: true
},
ssr: {
noExternal: ['custom-protocol-check']
},
optimizeDeps: {
exclude: ['custom-protocol-check']
},
mode,
build: {
sourcemap: true,
target: ['es2020'],
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('jszip')) {
return 'jszip';
}
if (id.includes('zod') || id.includes('felte')) {
return 'forms';
}
if (
id.includes('marked') ||
id.includes('prismjs') ||
id.includes('dompurify') ||
id.includes('jsdom') ||
id.includes('@cfworker/json-schema')
) {
return 'extras';
}
if (id.includes('node_modules')) {
return 'vendor';
}
}
},
plugins: [
...(mode !== 'development'
? [
terser({
format: {
comments: false
},
compress: false
})
]
: [])
]
}
}
};
export default config;