123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- import { defineConfig, UserConfigExport } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import path from 'path'
- import WindiCss from 'vite-plugin-windicss';
- import AutoImport from 'unplugin-auto-import/vite'
- import Components from 'unplugin-vue-components/vite'
- import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
- // https://vitejs.dev/config/
- export default defineConfig(({ command }) => {
- const config: UserConfigExport = {
- // base:'/app/xdjx/',
- // base: '/app/xdjy/',
- base: '/app/xdhq/',
- resolve: {
- alias: {
- '~': `${path.resolve(__dirname, 'src')}`,
- '~/': `${path.resolve(__dirname, 'src/')}`,
- '~components': `${path.resolve(__dirname, 'src/components')}`,
- '@': `${path.resolve(__dirname, 'src')}`,
- },
- },
- css: {
- preprocessorOptions: {
- scss: {
- additionalData: `@use "~/styles/element/index.scss" as *;`,
- },
- },
- },
- plugins: [
- vue(),
- WindiCss(),
- AutoImport({
- resolvers: [ElementPlusResolver()],
- }),
- Components({
- resolvers: [ElementPlusResolver()],
- }),
- ],
- build: {
- // target: 'modules'
- target: 'esnext',
- rollupOptions: {
- output: {
- manualChunks: {
- lodash: ['lodash-es'],
- echarts: ['echarts'],
- axios: ['axios']
- }
- }
- }
- },
- }
- if (command === 'serve') {
- config.base = "/"
- } else {
- }
- return config
- }
- )
|