您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

vite.config.ts 788B

1234567891011121314151617181920212223242526272829303132333435363738
  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. }