Skip to content

Instantly share code, notes, and snippets.

@wight554
Last active April 25, 2022 17:14
Show Gist options
  • Save wight554/85c2953764706f9171b4491905cf362e to your computer and use it in GitHub Desktop.
Save wight554/85c2953764706f9171b4491905cf362e to your computer and use it in GitHub Desktop.
/// <reference types="vitest" />
import path from 'path';
import preact from '@preact/preset-vite';
import { defineConfig } from 'vite';
import checker from 'vite-plugin-checker';
import typescript from 'vite-plugin-typescript';
import tsconfigPaths from 'vite-tsconfig-paths';
import { configDefaults } from 'vitest/config';
const isTest = process.env.NODE_ENV === 'test';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
preact({
include: '{test/,}src/**/*.{ts,tsx}',
}),
tsconfigPaths(),
!isTest &&
checker({
typescript: { tsconfigPath: 'src/tsconfig.json' },
eslint: {
lintCommand: 'eslint "./src/**/*.{ts,tsx}"',
},
}),
isTest && typescript(),
],
build: {
outDir: path.join(__dirname, 'dist/public'),
emptyOutDir: true,
},
test: {
environment: 'jsdom',
globals: true,
coverage: {
exclude: [...configDefaults.coverage.exclude, '**/schemas/**'],
},
setupFiles: ['test/testSetup.ts', 'test/recoilTestSetup.ts'],
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment