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.

39 lines
788B

  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. console.log(env)
  11. const viteEnv = wrapperEnv(env);
  12. const { VITE_PORT } = viteEnv;
  13. return {
  14. base: '/',
  15. plugins: [
  16. react(),
  17. WindiCSS()
  18. ],
  19. resolve: {
  20. alias: {
  21. '@/': '/src/',
  22. '/#/': '/types/'
  23. },
  24. },
  25. server: {
  26. https: false,
  27. host: true,
  28. port: VITE_PORT,
  29. },
  30. build: {
  31. manifest: true,
  32. sourcemap: true,
  33. }
  34. }
  35. }