You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vite.config.ts 768B

12345678910111213141516171819202122232425262728293031323334353637
  1. import type { UserConfig, ConfigEnv } from 'vite';
  2. import { loadEnv } from 'vite';
  3. import { wrapperEnv } from './build/utils';
  4. import react from '@vitejs/plugin-react';
  5. import WindiCSS from 'vite-plugin-windicss';
  6. // https://vitejs.dev/config/
  7. export default ({ command, mode }: ConfigEnv): UserConfig => {
  8. const root = process.cwd();
  9. const env = loadEnv(mode, root);
  10. const viteEnv = wrapperEnv(env);
  11. const { VITE_PORT } = viteEnv;
  12. return {
  13. base: '/',
  14. plugins: [
  15. react(),
  16. WindiCSS()
  17. ],
  18. resolve: {
  19. alias: {
  20. '@/': '/src/',
  21. '/#/': '/types/'
  22. },
  23. },
  24. server: {
  25. https: true,
  26. host: true,
  27. port: VITE_PORT,
  28. },
  29. build: {
  30. manifest: true,
  31. sourcemap: true,
  32. }
  33. }
  34. }