| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import path from 'path'
- import Components from 'unplugin-vue-components/vite'
- import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'
- export default defineConfig(({ mode }) => {
- const isProduction = mode === 'production'
- return {
- base: isProduction ? './' : '/',
- plugins: [
- vue(),
- Components({
- resolvers: [
- AntDesignVueResolver({
- importStyle: false, // css in js
- })
- ],
- })
- ],
- resolve: {
- alias: {
- '@': path.resolve(__dirname, 'src')
- }
- },
- css: {
- preprocessorOptions: {
- less: {
- math: 'always',
- globalVars: {},
- modifyVars: {
- 'hack': 'true; @import "@/styles/variables.less";'
- }
- }
- }
- },
- server: {
- port: 3000,
- open: true,
- proxy: {
- // '/api': {
- // // target: 'https://jiasm.zfire.top/zfdapi/',
- // target: 'https://jiasm.zfire.top',
- // ws: true,
- // changeOrigin: true,
- // rewrite: (path) => path.replace(/^\/api/, '')
- // }
- }
- },
- build: {
- outDir: 'dist',
- assetsDir: 'assets',
- rollupOptions: {
- output: {
- // 确保资源路径正确
- chunkFileNames: 'assets/[name]-[hash].js',
- entryFileNames: 'assets/[name]-[hash].js',
- assetFileNames: 'assets/[name]-[hash].[ext]'
- }
- }
- }
- }
- })
|