54 lines
1.2 KiB
TypeScript
54 lines
1.2 KiB
TypeScript
import { sentrySvelteKit } from '@sentry/sveltekit';
|
|
import { purgeCss } from 'vite-plugin-tailwind-purgecss';
|
|
import { sveltekit } from '@sveltejs/kit/vite';
|
|
import { defineConfig } from 'vitest/config';
|
|
import { threeMinifier } from '@yushijinhun/three-minifier-rollup';
|
|
import path from 'path';
|
|
|
|
export default defineConfig({
|
|
server: {
|
|
host: 'localhost',
|
|
port: 5174
|
|
},
|
|
build: {
|
|
// to resolve https://github.com/vitejs/vite/issues/6985
|
|
target: 'esnext'
|
|
},
|
|
envPrefix: 'PUBLIC_',
|
|
plugins: [
|
|
sentrySvelteKit({
|
|
sourceMapsUploadOptions: {
|
|
org: process.env.SENTRY_ORG,
|
|
project: process.env.SENTRY_PROJECT
|
|
},
|
|
telemetry: false
|
|
}),
|
|
sveltekit(),
|
|
purgeCss({
|
|
safelist: {
|
|
// any selectors that begin with "hljs-" will not be purged
|
|
greedy: [/^hljs-/]
|
|
}
|
|
}),
|
|
{ ...threeMinifier(), enforce: 'pre' }
|
|
],
|
|
define: {
|
|
'process.env.VITE_BUILD_TIME': JSON.stringify(new Date().toISOString())
|
|
},
|
|
ssr: {
|
|
noExternal: ['three']
|
|
},
|
|
|
|
test: {
|
|
include: ['src/**/*.{test,spec}.{js,ts}']
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
$lib: path.resolve(__dirname, 'src', 'lib'),
|
|
$root: path.resolve(__dirname),
|
|
$src: path.resolve(__dirname, 'src'),
|
|
$routes: path.resolve(__dirname, 'src', 'routes')
|
|
}
|
|
}
|
|
});
|