vite.config.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import react from '@vitejs/plugin-react-swc';
  2. import UnoCSS from 'unocss/vite';
  3. import { defineConfig, PluginOption } from 'vite';
  4. import pluginImport from 'vite-plugin-importer';
  5. import svgr from 'vite-plugin-svgr';
  6. import tsconfigPaths from 'vite-tsconfig-paths';
  7. /// <reference types="vite-plugin-svgr/client" />
  8. // https://vite.dev/config/
  9. export default defineConfig({
  10. resolve: {
  11. alias: [],
  12. },
  13. plugins: [
  14. svgr() as PluginOption,
  15. react(),
  16. UnoCSS(),
  17. pluginImport({
  18. libraryName: '@nutui/nutui-react',
  19. libraryDirectory: 'dist/esm',
  20. style: (path: string) => `${path}/style/css`,
  21. }),
  22. tsconfigPaths() as PluginOption,
  23. ],
  24. css: {
  25. // modules: {
  26. // hashPrefix: 'prefix',
  27. // generateScopedName: '[name]__[local]__[hash:base64:5]',
  28. // },
  29. preprocessorOptions: {
  30. sass: {
  31. api: 'modern',
  32. additionalData: `@nutui/nutui-react/dist/styles/variables.scss`,
  33. silenceDeprecations: ['legacy-js-api', 'color-functions'],
  34. },
  35. scss: {
  36. api: 'modern',
  37. silenceDeprecations: ['legacy-js-api'],
  38. },
  39. },
  40. },
  41. server: {
  42. proxy: {
  43. '/api': {
  44. target: 'https://precaution-check2.stage.leadinvr.com',
  45. changeOrigin: true,
  46. secure: false,
  47. },
  48. },
  49. },
  50. });