Files
chatgpt-web/vite.config.ts

32 lines
684 B
TypeScript
Raw Normal View History

2023-03-21 08:53:32 +01:00
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
2023-03-23 12:59:02 +01:00
import dsv from '@rollup/plugin-dsv'
2023-03-03 16:46:05 +01:00
import purgecss from '@fullhuman/postcss-purgecss'
2023-03-02 22:12:55 +04:00
2023-03-23 12:59:02 +01:00
const plugins = [svelte(), dsv()]
2023-03-02 22:12:55 +04:00
// https://vitejs.dev/config/
2023-03-03 16:56:19 +01:00
export default defineConfig(({ command, mode, ssrBuild }) => {
// Only run PurgeCSS in production builds
if (command === 'build') {
2023-03-03 16:56:19 +01:00
return {
2023-03-23 12:59:02 +01:00
plugins,
2023-03-03 16:56:19 +01:00
css: {
postcss: {
plugins: [
purgecss({
content: ['./**/*.html', './**/*.svelte'],
safelist: ['pre', 'code']
})
]
}
}
}
2023-03-03 16:56:19 +01:00
} else {
return {
2023-03-23 12:59:02 +01:00
plugins
}
2023-03-03 16:56:19 +01:00
}
})