chatgpt-web/vite.config.ts

33 lines
702 B
TypeScript
Raw Normal View History

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