| | |
| | | import tailwindcss from 'tailwindcss'; |
| | | import type { ConfigEnv } from 'vite'; |
| | | import { defineConfig, loadEnv } from 'vite'; |
| | | import { CodeInspectorPlugin } from 'code-inspector-plugin'; |
| | | import { visualizer } from 'rollup-plugin-visualizer'; |
| | | |
| | | import viteCompression from 'vite-plugin-compression'; |
| | | import vueSetupExtend from 'vite-plugin-vue-setup-extend-plus'; |
| | | const pathResolve = (dir: string) => { |
| | |
| | | const env = loadEnv(mode.mode, process.cwd()); |
| | | return { |
| | | plugins: [ |
| | | CodeInspectorPlugin({ |
| | | bundler: 'vite', |
| | | hotKeys: ['shiftKey'], |
| | | }), |
| | | vue(), |
| | | vueSetupExtend(), |
| | | viteCompression({ |
| | | threshold: 1024000, |
| | | }), |
| | | visualizer({ |
| | | gzipSize: true, |
| | | brotliSize: true, |
| | | emitFile: false, |
| | | filename: 'stats.html', //分析图生成的文件名 |
| | | |
| | | open: true, //如果存在本地服务端口,将在打包后自动展示 |
| | | }), |
| | | ], |
| | | root: process.cwd(), |
| | |
| | | host: '0.0.0.0', |
| | | port: env.VITE_PORT as unknown as number, |
| | | open: JSON.parse(env.VITE_OPEN), |
| | | hmr: true, |
| | | hmr: false, |
| | | }, |
| | | build: { |
| | | // outDir: 'dist/' + mode.mode, |