| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- // vite.config.ts
- import { defineConfig, loadEnv } from 'vite'
- import UniKuRoot from '@uni-ku/root'
- import uni from '@dcloudio/vite-plugin-uni'
- import AutoImport from 'unplugin-auto-import/vite'
- import Components from '@uni-helper/vite-plugin-uni-components'
- import { WotResolver } from './resolvers/wot-ui-resolver'
- import path from 'path'
- export default defineConfig(async ({ mode }) => {
- const { default: tsconfigPaths } = await import('vite-tsconfig-paths')
- const { VITE_BASE_API } = loadEnv(mode, process.cwd())
- const isH5 = process.env.UNI_PLATFORM === 'h5'
- return {
- plugins: [
- tsconfigPaths(),
- UniKuRoot(),
- AutoImport({
- imports: ['vue', 'pinia'],
- dts: 'src/auto-imports.d.ts',
- }),
- Components({
- resolvers: [WotResolver()],
- }),
- uni(),
- ],
- resolve: {
- alias: {
- '@': path.resolve(__dirname, 'src'),
- },
- },
- ...(isH5
- ? {
- build: {
- rollupOptions: {
- output: {
- entryFileNames: 'assets/[name]-[hash].js',
- chunkFileNames: 'assets/[name]-[hash].js',
- assetFileNames: 'assets/[name]-[hash][extname]',
- },
- },
- },
- }
- : {}),
- server: {
- proxy: {
- '/admin': {
- target: VITE_BASE_API,
- changeOrigin: true,
- },
- '/auth': {
- target: VITE_BASE_API,
- changeOrigin: true,
- },
- '/gig': {
- target: VITE_BASE_API,
- changeOrigin: true,
- },
- },
- },
- }
- })
|