Files
nodarium/packages/ui/vite.config.ts
Max Richter 89e4cf8364 chore: use vite for auto building @nodarium/ui instead of chokidar
We already use vite for building and during dev. Can use a custom vite
plugin to automatically package ui after every change, so no need for
chokidar.
2026-02-03 12:18:44 +01:00

27 lines
797 B
TypeScript

import { sveltekit } from '@sveltejs/kit/vite';
import tailwindcss from '@tailwindcss/vite';
import { exec } from 'node:child_process';
import { readFileSync } from 'node:fs';
import { defineConfig } from 'vitest/config';
const postDevPackagePlugin = () => {
const packageContent = JSON.parse(readFileSync('./package.json', { encoding: 'utf8' }));
let timeout: ReturnType<typeof setTimeout> | undefined;
return {
name: 'run-command-on-change',
handleHotUpdate: () => {
clearTimeout(timeout);
timeout = setTimeout(function() {
exec(packageContent.scripts.package);
}, 200);
}
} as const;
};
export default defineConfig({
plugins: [tailwindcss(), sveltekit(), postDevPackagePlugin()],
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
}
});