vite.config.ts 958 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. },
  34. },
  35. },
  36. });