vite.config.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /// <reference types="vitest" />
  2. import { defineConfig, Plugin } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. import tsconfigPaths from 'vite-tsconfig-paths'
  5. // import IstanbulPlugin from 'vite-plugin-istanbul'
  6. const plugins: Array<Plugin> = [vue(), tsconfigPaths()]
  7. if (process.env.CYPRESS_TEST === 'true') {
  8. // console.info('instrumenting code coverage for e2e tests...')
  9. // plugins.push(
  10. // IstanbulPlugin({
  11. // cypress: true,
  12. // checkProd: true,
  13. // exclude: ['dist', '.nyc_output', 'node_modules', 'coverage', 'test'],
  14. // include: ['src/*']
  15. // })
  16. // )
  17. }
  18. // https://vitejs.dev/config/
  19. export default defineConfig(({ mode }) => ({
  20. plugins,
  21. test: {
  22. server: {
  23. deps: {
  24. inline: ['date-fns']
  25. }
  26. },
  27. environment: 'happy-dom',
  28. globals: true,
  29. coverage: {
  30. all: true,
  31. exclude: ['*.config.{ts,js}', '**/*.d.ts', 'src/main.ts', 'dist', 'test'],
  32. functions: 80,
  33. branches: 80,
  34. statements: 80
  35. }
  36. },
  37. build: {
  38. sourcemap: mode === 'production' ? false : 'inline'
  39. },
  40. server: {
  41. port: 3000
  42. }
  43. }))