vite.config.js 998 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* eslint-env node */
  2. import {chrome} from '../../.electron-vendors.cache.json';
  3. import {join} from 'path';
  4. import vue from '@vitejs/plugin-vue';
  5. import {renderer} from 'unplugin-auto-expose';
  6. const PACKAGE_ROOT = __dirname;
  7. /**
  8. * @type {import('vite').UserConfig}
  9. * @see https://vitejs.dev/config/
  10. */
  11. const config = {
  12. mode: process.env.MODE,
  13. root: PACKAGE_ROOT,
  14. resolve: {
  15. alias: {
  16. '/@/': join(PACKAGE_ROOT, 'src') + '/',
  17. },
  18. },
  19. base: '',
  20. server: {
  21. fs: {
  22. strict: true,
  23. },
  24. },
  25. build: {
  26. sourcemap: true,
  27. target: `chrome${chrome}`,
  28. outDir: 'dist',
  29. assetsDir: '.',
  30. rollupOptions: {
  31. input: join(PACKAGE_ROOT, 'index.html'),
  32. },
  33. emptyOutDir: true,
  34. brotliSize: false,
  35. },
  36. test: {
  37. environment: 'happy-dom',
  38. },
  39. plugins: [
  40. vue(),
  41. renderer.vite({
  42. preloadEntry: join(PACKAGE_ROOT, '../preload/src/index.ts'),
  43. }),
  44. ],
  45. };
  46. export default config;