forked from Niek/chatgpt-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
34 lines (29 loc) · 860 Bytes
/
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
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import dsv from '@rollup/plugin-dsv';
import purgecss from '@fullhuman/postcss-purgecss';
const plugins = [svelte(), dsv()];
// https://vitejs.dev/config/
export default defineConfig(({ command, mode, ssrBuild }) => {
// Base configuration that applies to both build and dev
const config = {
plugins,
};
// Only run PurgeCSS in production builds
if (command === 'build') {
config.css = {
postcss: {
plugins: [
purgecss({
content: ['./**/*.html', './**/*.svelte'],
safelist: ['pre', 'code'],
}),
],
},
};
config.base = '/'; // Base set for build - change to './' if accessed on root URL
} else {
config.base = '/'; // Base set for dev
}
return config;
});