2023-03-21 08:53:32 +01:00
|
|
|
import { defineConfig } from 'vite'
|
2023-03-20 13:42:47 +01:00
|
|
|
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
|
|
|
|
2023-03-20 13:42:47 +01:00
|
|
|
import purgecss from '@fullhuman/postcss-purgecss'
|
2024-06-24 04:28:24 +09:00
|
|
|
// import { visualizer } from 'rollup-plugin-visualizer';
|
2023-03-02 22:12:55 +04:00
|
|
|
|
2024-06-24 04:28:24 +09:00
|
|
|
const plugins = [
|
2025-07-05 22:32:51 +09:00
|
|
|
svelte(),
|
|
|
|
|
dsv()
|
|
|
|
|
// visualizer({
|
|
|
|
|
// open: true,
|
|
|
|
|
// gzipSize: true,
|
|
|
|
|
// brotliSize: true,
|
|
|
|
|
// }),
|
2024-06-24 04:28:24 +09:00
|
|
|
]
|
2023-03-23 12:59:02 +01:00
|
|
|
|
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
|
2025-06-15 15:53:41 +09:00
|
|
|
if (command === 'builds') {
|
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({
|
2023-03-20 13:42:47 +01:00
|
|
|
content: ['./**/*.html', './**/*.svelte'],
|
|
|
|
|
safelist: ['pre', 'code']
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
}
|
2023-05-31 19:37:58 -05:00
|
|
|
},
|
2025-07-10 21:03:49 +09:00
|
|
|
base: './'
|
2023-03-20 13:42:47 +01:00
|
|
|
}
|
2023-03-03 16:56:19 +01:00
|
|
|
} else {
|
|
|
|
|
return {
|
2023-03-23 12:59:02 +01:00
|
|
|
plugins
|
2023-03-20 13:42:47 +01:00
|
|
|
}
|
2023-03-03 16:56:19 +01:00
|
|
|
}
|
2023-03-20 13:42:47 +01:00
|
|
|
})
|