12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import react from '@vitejs/plugin-react-swc';
- import UnoCSS from 'unocss/vite';
- import { defineConfig, loadEnv, PluginOption } from 'vite';
- 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(({ mode }) => {
- const config = loadEnv(mode, './');
- return {
- resolve: {
- alias: [],
- },
- plugins: [
- svgr() as PluginOption,
- react(),
- UnoCSS(),
- // pluginImport({
- // libraryName: '@nutui/nutui-react',
- // libraryDirectory: 'dist/esm',
- // style: (path: string) => {
- // const capitalized =
- // path.charAt(0).toUpperCase()
- // + path.slice(1)
- // return capitalized
- // },
- // camel2DashComponentName: true
- // }),
- 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`,
- silenceDeprecations: ['legacy-js-api', 'color-functions'],
- },
- scss: {
- api: 'modern',
- silenceDeprecations: ['legacy-js-api'],
- },
- },
- },
- server: {
- proxy: {
- '/api': {
- target: config.VITE_BASIC_URL,
- changeOrigin: true,
- secure: false,
- },
- },
- },
- };
- });
|