61 lines
1.5 KiB
TypeScript
61 lines
1.5 KiB
TypeScript
import { paraglideVitePlugin } from '@inlang/paraglide-js'
|
|
import { sveltekit } from '@sveltejs/kit/vite'
|
|
import { defineConfig } from 'vite'
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
$src: fileURLToPath(new URL('./src', import.meta.url)),
|
|
$themes: fileURLToPath(new URL('./src/themes', import.meta.url))
|
|
}
|
|
},
|
|
css: {
|
|
preprocessorOptions: {
|
|
scss: {
|
|
api: 'modern-compiler',
|
|
loadPaths: [fileURLToPath(new URL('./src', import.meta.url))]
|
|
}
|
|
}
|
|
},
|
|
assetsInclude: ['**/*.svg'],
|
|
plugins: [
|
|
sveltekit(),
|
|
paraglideVitePlugin({
|
|
project: './project.inlang',
|
|
outdir: './src/lib/paraglide',
|
|
// Enable once everything is working
|
|
// strategy: ['preferredLanguage', 'url', 'cookie', 'baseLocale']
|
|
strategy: ['preferredLanguage', 'url', 'cookie', 'baseLocale']
|
|
})
|
|
],
|
|
test: {
|
|
expect: { requireAssertions: true },
|
|
projects: [
|
|
{
|
|
extends: './vite.config.ts',
|
|
test: {
|
|
name: 'client',
|
|
environment: 'browser',
|
|
browser: {
|
|
enabled: true,
|
|
provider: 'playwright',
|
|
instances: [{ browser: 'chromium' }]
|
|
},
|
|
include: ['src/**/*.svelte.{test,spec}.{js,ts}'],
|
|
exclude: ['src/lib/server/**'],
|
|
setupFiles: ['./vitest-setup-client.ts']
|
|
}
|
|
},
|
|
{
|
|
extends: './vite.config.ts',
|
|
test: {
|
|
name: 'server',
|
|
environment: 'node',
|
|
include: ['src/**/*.{test,spec}.{js,ts}'],
|
|
exclude: ['src/**/*.svelte.{test,spec}.{js,ts}']
|
|
}
|
|
}
|
|
]
|
|
}
|
|
})
|