1234567891011121314151617181920212223242526272829303132333435363738 |
- import react from '@vitejs/plugin-react-swc';
- import UnoCSS from 'unocss/vite';
- import { defineConfig, PluginOption } from 'vite';
- import pluginImport from 'vite-plugin-importer';
- import svgr from 'vite-plugin-svgr';
- import tsconfigPaths from 'vite-tsconfig-paths';
- /// <reference types="vite-plugin-svgr/client" />
- // https://vite.dev/config/
- export default defineConfig({
- resolve: {
- alias: [],
- },
- plugins: [
- svgr() as PluginOption,
- react(),
- UnoCSS(),
- pluginImport({
- libraryName: '@nutui/nutui-react',
- libraryDirectory: 'dist/esm',
- style: (path: string) => `${path}/style/css`,
- }),
- tsconfigPaths() as PluginOption,
- ],
- css: {
- modules: {
- hashPrefix: 'prefix',
- generateScopedName: '[name]__[local]__[hash:base64:5]',
- },
- preprocessorOptions: {
- sass: {
- api: 'modern',
- additionalData: `@nutui/nutui-react/dist/styles/variables.scss`,
- },
- },
- },
- });
|