| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- import { fileURLToPath, URL } from 'node:url'
- import path from 'path'
- import { defineConfig, loadEnv } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import vueJsx from '@vitejs/plugin-vue-jsx'
- import AutoImport from 'unplugin-auto-import/vite'
- import Components from 'unplugin-vue-components/vite'
- import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
- import { createStyleImportPlugin, VxeTableResolve } from 'vite-plugin-style-import'
- import Unocss from 'unocss/vite'
- import VueDevTools from 'vite-plugin-vue-devtools'
- import { lazyImport, VxeResolver } from 'vite-plugin-lazy-import'
- import esLintPlugin from 'vite-plugin-eslint'
- export default defineConfig(({ mode }) => {
- const env = loadEnv(mode, process.cwd(), '')
- return {
- base: '/',
- plugins: [
- vue(),
- vueJsx(),
- Unocss(),
- VueDevTools(),
- esLintPlugin({
- emitError: true
- }),
- AutoImport({
- imports: ['vue', 'vue-router', 'pinia', '@vueuse/core'],
- dts: 'src/auto-import.d.ts'
- }),
- Components({
- dirs: ['src/components'],
- extensions: ['vue'],
- dts: 'src/components.d.ts'
- }),
- createSvgIconsPlugin({
- iconDirs: [path.resolve(process.cwd(), 'src/assets/svg')],
- symbolId: 'icon-[dir]-[name]'
- }),
- createStyleImportPlugin({
- resolves: [VxeTableResolve()]
- }),
- lazyImport({
- resolvers: [
- VxeResolver({
- libraryName: 'vxe-table'
- }),
- VxeResolver({
- libraryName: 'vxe-pc-ui'
- })
- ]
- })
- ],
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
- }
- },
- server: {
- proxy: {
- [env.VITE_BASE_API]: {
- target: env.VITE_BASE_PATH,
- changeOrigin: true
- }
- },
- hmr: {
- overlay: true
- }
- },
- build: {
- rollupOptions: {
- output: {
- manualChunks: {
- vueChunk: ['vue', 'vue-router', 'pinia', '@vueuse/core'],
- elementPlusChunk: ['element-plus', '@element-plus/icons-vue'],
- mapChunk: ['@amap/amap-jsapi-loader'],
- fsChunk: ['@fskj-admin/core', '@fskj-admin/micro'],
- tableChunk: ['vxe-table', 'vxe-pc-ui', 'xe-utils', '@vxe-ui/plugin-render-element'],
- editorChunk: ['@wangeditor-next/editor', '@wangeditor-next/editor-for-vue'],
- otherChunk: ['axios', 'dayjs', 'wujie-vue3']
- }
- }
- }
- }
- }
- })
|